From a.wollbrink at uni-muenster.de Fri Apr 1 16:37:45 2011 From: a.wollbrink at uni-muenster.de (Andreas Wollbrink) Date: Fri, 01 Apr 2011 16:37:45 +0200 Subject: [FieldTrip] Dipole time course In-Reply-To: <2E7764CB-846C-4A40-A4FB-7F6C3376C465@ucdenver.edu> References: <722089035bbba.4d93df8a@mail.uh.edu> <0A4E2DDD-B79F-4B96-A777-CB880E117016@donders.ru.nl> <2E7764CB-846C-4A40-A4FB-7F6C3376C465@ucdenver.edu> Message-ID: <4D95E339.6070604@uni-muenster.de> Hi Don, I just tried out your approach on how to achieve the source waveform based on a given dipole source but failed calculating the scalar product of the inverse leadfield matrix and the normed orientation vector: W = dot(Li,Qn); error message: A and B must be same size. May I ask you for a suggestion? Best, Andreas On 03/31/11 17:57, Rojas, Don wrote: > Mehmet et al. > > As a follow up to this, once you have the orientation info from the > dipole, the source space projection you wish to achieve to derive the > timecourse can be done as follows (or at least something similar to > this), assuming you have the fieldtrip data (data) the source, and the > volume conductor (vol): > > L = ft_compute_leadfield(source.dip.pos, data.grad,vol); % leadfields > Li = pinv(L); % pseudoinverse of L > Qn = double(orientation_vector)/norm(orientation_vector); % normed > orientation vector > W = dot(Li,Qn); % weights for projection to source space > waveform = dot(data,repmat(W',1,length(data))); % source waveform > > where the orientation_vector is a 1 x 3 vector of qx, qy and qz. This > can be had from one of your sources from source.dip.mom, or from the > suggestion of Jan-Mathijs. I don't know if the data you have is an > average that you want to project into source space or individual trials. > If you want to do this with the individual trials, you'd just need to do > the last piece of code above as a for loop through your trials - you > don't have to recompute the weights (W) used for the projection. > > Best, > > Don > > On Mar 31, 2011, at 1:38 AM, jan-mathijs schoffelen wrote: > >> Hi Mehmet, >> >> I forward this to the mailing list, so that people can participate in >> the thread. >> >> I do not fully understand where the orientation information in the vol >> comes from. The description of the volume conductor is namely a >> geometrical object, containing either a (set of) triangulated >> surface(s), to describe compartment boundaries, or the description of >> a (set of) sphere(s), with an origin and a radius. >> The outcome of the dipolefitting algorithm gives you a field, called >> dip.mom, describing the dipole moment as a function of time. At each >> time point, the three numbers reflect the instantaneous orientation of >> the dipole. Since you are working with MEG, I assume that the >> orientation of this dipole is actually defined on a plane, because we >> routinely suppress the component with the most radial orientation from >> the leadfield. One way of reducing the dimension is to check whether >> there is a single dominant orientation over time. This can be achieved >> by doing a pca (or svd) of dip.mom. The ratio of the first two >> singular values specifies how well the dipole can be approximated as >> one having a fixed orientation. The left singular vectors give you the >> projection vectors, and thus specify the orientation. In other words >> [u,s,v] = svd(dip.mom). if s(1,1) >> s(2,2), one could justify to use >> u(:,1) as the 'orientation' of the corresponding dipole. >> >> Best, >> >> Jan-Mathijs >> >> >> >> >> >> Begin forwarded message: >> >>> *From: *Mehmet-Akif Coskun >> > >>> *Date: *March 31, 2011 8:57:30 AM GMT+02:00 >>> *To: *jan-mathijs schoffelen >> > >>> *Subject: **Dipole time course* >>> >>> Hi Jan, >>> Thanks for all your help. I am really close to get the dipole time courses. Everything looks fine in terms of reading data, preprocessing, creating headmodel and fitting a dipole. The last part is to obtain a dipole time course. >>> >>> I actually read through the previous emails in discussion list and followed the advices. I used the code below to obtain the leadfield and then project the pinv'ed leadfield onto ERF to get the dipole course. But the leadfield is 3D so i get 3 time courses. >>> % prepare leadfield cfg=[]; cfg.grad= hdr.grad; cfg.vol=vol; cfg.channel='MEG'; cfg.grid.pos=dipM50.dip.pos; >>> [grid_ft_segment2]=ft_prepare_leadfield(cfg); >>> >>> In the email below, you suggested to an other user to multiply the 3D leadfields with the orientation estimated by the dipole fit. I checked the outcome of the dipole but there wasn't any orientation information. However, i checked the vol structure which has the orientation and multiply 3D leadfields with vol.ori and then project 1d leadfield onto ERF. I got a nice looking time course. I just wonder whether what i did is meaningful. >>> >>> Thanks >>> Mehmet >>> >>> P.S= Below is your previous email >>> I suspect that the 'orientation' onto which the pca projects the dipoles is not optimal. Perhaps you might want to try the other way, i.e. compute the leadfields in 1D, either by specifying something in cfg.grid.mom (or ori, I keep forgetting) before calling prepare_leadfield, or by postmultiplying the 3D leadfields with the orientation as estimated by the dipole fit. >> >> Dr. J.M. (Jan-Mathijs) Schoffelen >> Donders Institute for Brain, Cognition and Behaviour, >> Centre for Cognitive Neuroimaging, >> Radboud University Nijmegen, The Netherlands >> J.Schoffelen at donders.ru.nl >> Telephone: 0031-24-3614793 >> >> _______________________________________________ >> fieldtrip mailing list >> fieldtrip at donders.ru.nl >> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > > ----------------------- > Don Rojas, Ph.D. > Associate Professor of Psychiatry > U. of Colorado Denver Anschutz Medical Campus > Director, UCD Magnetoencephalography Lab > 13001 E. 17th Pl F546 > Aurora, CO 80045 > 303-724-4994 > > > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip -- ====================================================================== Andreas Wollbrink, Biomedical Engineer Institute for Biomagnetism and Biosignalanalysis Muenster University Hospital Malmedyweg 15 phone: +49-(0)251-83-52546 D-48149 Muenster mobil: +49-(0)160-98527553 Germany fax: +49-(0)251-83-56874 e-Mail: a.wollbrink at uni-muenster.de ====================================================================== From Don.Rojas at ucdenver.edu Fri Apr 1 20:15:00 2011 From: Don.Rojas at ucdenver.edu (Rojas, Don) Date: Fri, 1 Apr 2011 12:15:00 -0600 Subject: [FieldTrip] Dipole time course In-Reply-To: <1F405F51-C58D-446B-A2F2-2EBD3ACBB908@ucdenver.edu> References: <722089035bbba.4d93df8a@mail.uh.edu> <0A4E2DDD-B79F-4B96-A777-CB880E117016@donders.ru.nl> <2E7764CB-846C-4A40-A4FB-7F6C3376C465@ucdenver.edu> <4D95E339.6070604@uni-muenster.de> <1F405F51-C58D-446B-A2F2-2EBD3ACBB908@ucdenver.edu> Message-ID: Andreas, I just wrote that code snippet from memory so it figures it wouldn't work without a little clean up. I forgot what the dimensions would be of the Li and Qn variables and the dot operation has to have arrays of the same size as input. I tested an example and this correction should work for you. I also corrected a parenthetic error on the use of double in the Qn line that would not have generated an error. I added a couple of transposes here and there. But, check your sizes as follows if you have problems - often, something will just need to be transposed to get it into the proper shape. I added some info on each input and variable to hopefully clarify what I'm after in the example: source.dip.pos: 1 x 3 orientation_vector: 1 x 3 (Fieldtrip source structure orientation is 3 x 1 per dipole, so probably need to transpose if getting from source structure) L: nchannels x 3 Li: 3 x nchannels; Qn: 1 x 3, then 3 x nchannels after repmat() W: 1 x nchannels waveform: 1 x nsamples data: Fieldtrip timelock structure with avg field data.avg: nchannels x nsamples vol: volume conductor in Fieldtrip - I coded this with a single sphere model source: source output from ft_dipolefitting() Revised code example: L = ft_compute_leadfield(source.dip.pos, data.grad,vol,'reducerank',2); % leadfield Li = pinv(L); % pseudoinverse of L Qn = double(orientation_vector/norm(orientation_vector)); % normed orientation vector Qn = repmat(Qn,length(Li),1)'; % make Qn the same size as Li W = dot(Li,Qn)'; % weights for projection to source space waveform = dot(data.avg,repmat(W,1,size(data.avg,2))); % source waveform Hope that helps. I'm thinking that if your gradiometer data scaling is in meters (check your grad structure) and the input data scaling to the last dot operation is in fT, then your output scale will be A-m (1e-9), but you might want to check since I didn't confirm that. I think by default the fieldtrip MEG data are in units of T so you might need to scale your input data accordingly to get your desired output scale. But then, I'm assuming MEG gradiometer data input, so if you have something else, check your function call to ft_compute_leadfield and adjust your scaling accordingly. Don On Apr 1, 2011, at 8:37 AM, Andreas Wollbrink wrote: > Hi Don, > > I just tried out your approach on how to achieve the source waveform > based on a given dipole source but failed calculating the scalar product > of the inverse leadfield matrix and the normed orientation vector: > > W = dot(Li,Qn); > > error message: A and B must be same size. > > May I ask you for a suggestion? > > Best, > Andreas > From a.wollbrink at uni-muenster.de Mon Apr 4 15:51:26 2011 From: a.wollbrink at uni-muenster.de (Andreas Wollbrink) Date: Mon, 04 Apr 2011 15:51:26 +0200 Subject: [FieldTrip] Dipole time course In-Reply-To: References: <722089035bbba.4d93df8a@mail.uh.edu> <0A4E2DDD-B79F-4B96-A777-CB880E117016@donders.ru.nl> <2E7764CB-846C-4A40-A4FB-7F6C3376C465@ucdenver.edu> <4D95E339.6070604@uni-muenster.de> <1F405F51-C58D-446B-A2F2-2EBD3ACBB908@ucdenver.edu> Message-ID: <4D99CCDE.6000407@uni-muenster.de> Hi Don, thanks for your advices. I succeeded calculating the source waveform time series using your modified script lines. Since the number of sensors in the data.grad field was different from the number of channels in the data.avg matrix I added the following line to the beginning of your code: [vol, grad] = ft_prepare_vol_sens(vol, avgData.grad, 'channel', avgData.label); I am using data recorded with the 275 channel axial gradiometer VSM system. During the recording 3 channels were defined as bad. The noise balancing was set to 1 (first order synthetic gradiometers). Using ft_preprocessing and ft_timelockanalysis with the the setting cfg.channel = 'MEG' one ends up with 272 channels in the data.avg matrix and 281 sensors in the cfg.grad structure. Since I am not sure whether it is correct to apply the ft_prepare_vol_sens function in the way I did it I would appreciate if an expert could comment on that. Andreas On 04/01/11 20:15, Rojas, Don wrote: > Andreas, > > I just wrote that code snippet from memory so it figures it wouldn't work without a little clean up. I forgot what the dimensions would be of the Li and Qn variables and the dot operation has to have arrays of the same size as input. I tested an example and this correction should work for you. I also corrected a parenthetic error on the use of double in the Qn line that would not have generated an error. I added a couple of transposes here and there. But, check your sizes as follows if you have problems - often, something will just need to be transposed to get it into the proper shape. I added some info on each input and variable to hopefully clarify what I'm after in the example: > > source.dip.pos: 1 x 3 > orientation_vector: 1 x 3 (Fieldtrip source structure orientation is 3 x 1 per dipole, so probably need to transpose if getting from source structure) > L: nchannels x 3 > Li: 3 x nchannels; > Qn: 1 x 3, then 3 x nchannels after repmat() > W: 1 x nchannels > waveform: 1 x nsamples > data: Fieldtrip timelock structure with avg field > data.avg: nchannels x nsamples > vol: volume conductor in Fieldtrip - I coded this with a single sphere model > source: source output from ft_dipolefitting() > > Revised code example: > > L = ft_compute_leadfield(source.dip.pos, data.grad,vol,'reducerank',2); % leadfield > Li = pinv(L); % pseudoinverse of L > Qn = double(orientation_vector/norm(orientation_vector)); % normed orientation vector > Qn = repmat(Qn,length(Li),1)'; % make Qn the same size as Li > W = dot(Li,Qn)'; % weights for projection to source space > waveform = dot(data.avg,repmat(W,1,size(data.avg,2))); % source waveform > > Hope that helps. I'm thinking that if your gradiometer data scaling is in meters (check your grad structure) and the input data scaling to the last dot operation is in fT, then your output scale will be A-m (1e-9), but you might want to check since I didn't confirm that. I think by default the fieldtrip MEG data are in units of T so you might need to scale your input data accordingly to get your desired output scale. But then, I'm assuming MEG gradiometer data input, so if you have something else, check your function call to ft_compute_leadfield and adjust your scaling accordingly. > > Don > > On Apr 1, 2011, at 8:37 AM, Andreas Wollbrink wrote: > >> Hi Don, >> >> I just tried out your approach on how to achieve the source waveform >> based on a given dipole source but failed calculating the scalar product >> of the inverse leadfield matrix and the normed orientation vector: >> >> W = dot(Li,Qn); >> >> error message: A and B must be same size. >> >> May I ask you for a suggestion? >> >> Best, >> Andreas >> > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip -- ====================================================================== Andreas Wollbrink, Biomedical Engineer Institute for Biomagnetism and Biosignalanalysis Muenster University Hospital Malmedyweg 15 phone: +49-(0)251-83-52546 D-48149 Muenster mobil: +49-(0)160-98527553 Germany fax: +49-(0)251-83-56874 e-Mail: a.wollbrink at uni-muenster.de ====================================================================== From recasensmarc at gmail.com Tue Apr 5 18:54:01 2011 From: recasensmarc at gmail.com (Marc Recasens) Date: Tue, 5 Apr 2011 18:54:01 +0200 Subject: [FieldTrip] Source reconstruction and NAI Message-ID: Dear all, As far as I know it is possible to reconstruct the time-course of the sources (obtained using sourceanalysis) by projecting/multiplying the filter-weights on the data. In my case, the specific code I am using is: for i=1:nvoxels(inside) for tr=1:ntrials ts(tr,:)=(source.avg.ori{source.inside(i)}(1,:)*source.avg.filter{source.inside(i)}*data2{condit}.trial{tr}); end datvx(i,:,:)= single_trial_time_course end I used a common filter with 3 different conditions, thus I think this is the only way I have to reconstruct the activity for one of the conditions. My Question is about how to apply the NAI normalization here. Can I just divide the output of the source reconstruction by the projected noise of the filter? I am tempted to do something like that datvx(i,:,:)= single_trial_time_course ./ repmat(noise(inside),[size(ts,1), size(ts,2)] That is, I divide the power by the noise estimate (for each voxel) in every trial and time-point. Could anyone tell me whether this is a correct way to procedure? Any other workaround? Thanks in advance! -- Marc Recasens Tel.: +34 639 24 15 98 -------------- next part -------------- An HTML attachment was scrubbed... URL: From nathanweisz at mac.com Thu Apr 7 11:31:35 2011 From: nathanweisz at mac.com (Nathan Weisz) Date: Thu, 07 Apr 2011 11:31:35 +0200 Subject: [FieldTrip] cfg.latency and ft_timelockanalysis Message-ID: <934EFFDB-DED1-4F8C-BE1F-9F7AC2D9B447@mac.com> hi, i just noticed that the option cfg.latency has been deprecated from ft_timelockanalysis. does this have a specific reason? seems to be done on purpose :-) i am asking because i always thought that it was a nice feature when later using beamformer analysis (lcmv) to have a more narrow window to calculate e.g. power (using ft_sourcedescriptives) or to orient sources when later applying filters to raw data, and to have a wider window including also prestim periods for covariance estimation. of course the workaround is to run two timelocks with a redefinetrial in between. but it appears rather awkward. thanks for any input, nathan From s.mohr at psy.gla.ac.uk Thu Apr 7 12:55:04 2011 From: s.mohr at psy.gla.ac.uk (sibylle) Date: Thu, 7 Apr 2011 11:55:04 +0100 Subject: [FieldTrip] plv and sourceanalysis Message-ID: <0EA26325-41FA-4669-A95D-A643F2D8F84F@psy.gla.ac.uk> Dear Fieldtrippers, I have a couple of question and I hope someone can help me: How is it possible to compute plv (for freq data)? As far as I can remember there used to be an option within ft_sourcedescriptives, which seems to have disappeared. How can one use plv to determine connectivity in source space? Thanks a lot & best wishes, Sibylle From sklein at berkeley.edu Thu Apr 7 13:09:46 2011 From: sklein at berkeley.edu (Stanley Klein) Date: Thu, 7 Apr 2011 04:09:46 -0700 Subject: [FieldTrip] plv and sourceanalysis In-Reply-To: <0EA26325-41FA-4669-A95D-A643F2D8F84F@psy.gla.ac.uk> References: <0EA26325-41FA-4669-A95D-A643F2D8F84F@psy.gla.ac.uk> Message-ID: Speaking of plv, two weeks ago I sent out a question regarding plv, but I don't recall getting any responses. My questions were: 1) By ignoring the phasor magnitudes when summing over trials, isn't plv noisier than standard coherence that includes magnitudes? 2) By including the real part isn't plv often dominated by volume conduction that can be avoided by just looking at the imaginary part of coherence (sadly the imaginary part may be hard to interpret and it ignores the non-volume conducting contributions to the real part). My original posting included: *"I recall that when Lachaux et al. (1999) introduced it (I think it was them) I didn't understand what is the advantage of adding unit magnitude phasors. I would have thought that neglecting the magnitude of the phasor would give a noisier measure of coherence. Another worry is that the PLV includes the real part of the phasor which is contaminated by the volume conduction from the forward model. To avoid that contamination many people only look at the imaginary part (the aspect of PLV with 90 deg phase shift). The problem with the imaginary part is that one loses the information from the non-volume conduction real part."* thanks, Stan On Thu, Apr 7, 2011 at 3:55 AM, sibylle wrote: > Dear Fieldtrippers, > > I have a couple of question and I hope someone can help me: > How is it possible to compute plv (for freq data)? > As far as I can remember there used to be an option within > ft_sourcedescriptives, which seems to have disappeared. > How can one use plv to determine connectivity in source space? > > Thanks a lot & best wishes, > > Sibylle > > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jan.schoffelen at donders.ru.nl Thu Apr 7 14:14:10 2011 From: jan.schoffelen at donders.ru.nl (jan-mathijs schoffelen) Date: Thu, 7 Apr 2011 14:14:10 +0200 Subject: [FieldTrip] cfg.latency and ft_timelockanalysis In-Reply-To: <934EFFDB-DED1-4F8C-BE1F-9F7AC2D9B447@mac.com> References: <934EFFDB-DED1-4F8C-BE1F-9F7AC2D9B447@mac.com> Message-ID: Hi Nathan, Yes, we thought long and deep about this, and we concluded that cfg.latency was to be kicked out as an option. We had the impression that the old-style cfg options were a bit confusing and counter- intuitive. First of all, apologies that we did not communicate this change more clearly, we kind of assumed that hardly anyone used this option anyway. This is our take on it: If you use ft_timelockanalysis in order to compute a covariance to be used in ft_sourceanalysis, cfg.covariancewindow is the option that specifies the latency for the covariance. A call to ft_timelockanalysis will then give you the event-related field for free, but the latency of this ERF is not anymore confined (which was previously done by cfg.latency). What we thought was confusing (and potentially unwanted), is that the user could specify totally different windows for the covariance computation and for the latency, which could lead to the spatial filters being optimized for a stretch of data totally different from the source-reconstructed data the user would be looking at after the call to ft_sourceanalysis. It is the covariancewindow that eventually determines the shape of the spatial filters and the idea was that one could just as well project the whole ERF through the spatial filters and apply latency constraints later on, if necessary. This functionality (i.e. the application of latency constraints is not yet fully operational, but we're working on it). If the user would like to do some fancy stuff (which you seem to like ;o) ) we'd rather make it explicit that ft_sourceanalysis needs to be run twice (in the first round obviously with cfg.keepfilter = 'yes'), instead of running the risk that the user doesn't fully obtain what he/she asked for. Obviously, the scenario you sketch is perfectly valid and we understand that you like it to still be supported. We however hope that you appreciate the fact that we trust our expert users to take this little inconvenience for granted at the benefit of more transparent code and less trouble for the novice users. Best wishes, Jan-Mathijs On Apr 7, 2011, at 11:31 AM, Nathan Weisz wrote: > hi, > > i just noticed that the option cfg.latency has been deprecated from > ft_timelockanalysis. > > does this have a specific reason? seems to be done on purpose :-) > > i am asking because i always thought that it was a nice feature when > later using beamformer analysis (lcmv) to have a more narrow window > to calculate e.g. power (using ft_sourcedescriptives) or to orient > sources when later applying filters to raw data, and to have a wider > window including also prestim periods for covariance estimation. > > of course the workaround is to run two timelocks with a > redefinetrial in between. but it appears rather awkward. > > thanks for any input, > nathan > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 From jan.schoffelen at donders.ru.nl Thu Apr 7 14:23:58 2011 From: jan.schoffelen at donders.ru.nl (jan-mathijs schoffelen) Date: Thu, 7 Apr 2011 14:23:58 +0200 Subject: [FieldTrip] Source reconstruction and NAI In-Reply-To: References: Message-ID: Dear Marc, It seems from your question that you are interested in single trial reconstructed time series. If your purpose is to do a statistical comparison across a set of conditions I would not do a noise normalization at all. You mention that you used a spatial filter common to the three conditions. As a consequence, the estimate of the noise will be independent of the condition, so any normalization you would apply just leads to a scaling of the data, and will not change the outcome of your statistical test. Yet, I understand that it sometimes makes sense to do a normalization in order to be able to make a sensible visualization of the data (i.e. removing the big central blob). Also, in this case I would compute a descriptive statistic across the conditions, rather than normalizing with an estimate of the projected noise (which in FieldTrip is rather rudimentary because it assumes the noise to be spatially white). You could for example compute an F-value from a one-factor, three level anova, or do a pairwise comparison of conditions using a t-test. Another alternative (which does not affect your statistical test either), is to work with norm-normalized leadfields. This will take away the blob in the centre of the volume, and facilitates visualization. Best wishes, Ja-Mathijs On Apr 5, 2011, at 6:54 PM, Marc Recasens wrote: > Dear all, > > As far as I know it is possible to reconstruct the time-course of > the sources (obtained using sourceanalysis) by projecting/ > multiplying the filter-weights on the data. > In my case, the specific code I am using is: > for i=1:nvoxels(inside) > > for tr=1:ntrials > > ts(tr,:)=(source.avg.ori{source.inside(i)} > (1,:)*source.avg.filter{source.inside(i)}*data2{condit}.trial{tr}); > > end > > datvx(i,:,:)= single_trial_time_course > > end > > I used a common filter with 3 different conditions, thus I think > this is the only way I have to reconstruct the activity for one of > the conditions. > My Question is about how to apply the NAI normalization here. Can I > just divide the output of the source reconstruction by the projected > noise of the filter? I am tempted to do something like that > > datvx(i,:,:)= single_trial_time_course ./ repmat(noise(inside), > [size(ts,1), size(ts,2)] > > That is, I divide the power by the noise estimate (for each voxel) > in every trial and time-point. Could anyone tell me whether this is > a correct way to procedure? Any other workaround? > > > > Thanks in advance! > > -- > Marc Recasens > Tel.: +34 639 24 15 98 > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 -------------- next part -------------- An HTML attachment was scrubbed... URL: From jan.schoffelen at donders.ru.nl Thu Apr 7 14:28:18 2011 From: jan.schoffelen at donders.ru.nl (jan-mathijs schoffelen) Date: Thu, 7 Apr 2011 14:28:18 +0200 Subject: [FieldTrip] plv and sourceanalysis In-Reply-To: <0EA26325-41FA-4669-A95D-A643F2D8F84F@psy.gla.ac.uk> References: <0EA26325-41FA-4669-A95D-A643F2D8F84F@psy.gla.ac.uk> Message-ID: <6ADFF688-0149-4940-9F99-C83741BD5308@donders.ru.nl> Dear Sibylle, You confuse me a bit. You mention ft_sourcedescriptives in combination with freq data. Do you mean that you have source-level data in the frequency domain, or do you have freq-data, as in sensor level data having been processed by ft_freqanalysis? In the former case, I do not recall that ft_sourcedescriptives could compute a plv. In the latter case: it was indeed supported by ft_freqdescriptives. A while ago we moved the functionality of ft_freqdescriptives dealing with coherence/plv etc to ft_connectivityanalysis. So I'd suggest to have a look there. Also, I think it should be possible to use ft_connectivityanalysis to compute source level plv, but this may still need some tweaking. Best wishes, Jan-Mathijs On Apr 7, 2011, at 12:55 PM, sibylle wrote: > Dear Fieldtrippers, > > I have a couple of question and I hope someone can help me: > How is it possible to compute plv (for freq data)? > As far as I can remember there used to be an option within > ft_sourcedescriptives, which seems to have disappeared. > How can one use plv to determine connectivity in source space? > > Thanks a lot & best wishes, > > Sibylle > > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 From jan.schoffelen at donders.ru.nl Thu Apr 7 14:29:54 2011 From: jan.schoffelen at donders.ru.nl (jan-mathijs schoffelen) Date: Thu, 7 Apr 2011 14:29:54 +0200 Subject: [FieldTrip] plv and sourceanalysis In-Reply-To: References: <0EA26325-41FA-4669-A95D-A643F2D8F84F@psy.gla.ac.uk> Message-ID: <5AADFF53-1C6A-4541-A21E-DF462587EB20@donders.ru.nl> Dear Stan, Here is my take on it: > Speaking of plv, two weeks ago I sent out a question regarding plv, > but I don't recall getting any responses. My questions were: > > 1) By ignoring the phasor magnitudes when summing over trials, isn't > plv noisier than standard coherence that includes magnitudes? > Yes > 2) By including the real part isn't plv often dominated by volume > conduction that can be avoided by just looking at the imaginary part > of coherence (sadly the imaginary part may be hard to interpret and > it ignores the non-volume conducting contributions to the real part). I agree. What's the question here? Best wishes, Jan-Mathijs From Gregor.Volberg at psychologie.uni-regensburg.de Thu Apr 7 15:10:05 2011 From: Gregor.Volberg at psychologie.uni-regensburg.de (Gregor Volberg) Date: Thu, 07 Apr 2011 15:10:05 +0200 Subject: [FieldTrip] Antw: plv and sourceanalysis In-Reply-To: <0EA26325-41FA-4669-A95D-A643F2D8F84F@psy.gla.ac.uk> References: <0EA26325-41FA-4669-A95D-A643F2D8F84F@psy.gla.ac.uk> Message-ID: <4D9DD3CD0200005700008F9F@gwsmtp1.uni-regensburg.de> Dear Sybille, the plv option is now within ft_connectivityanalysis. I was successful with the code given below (ft_freqanalysis changed a bit in newer versions of fieldtrip so there might be some small corrections necessary). As much as I know, a plv analysis on source activity is not implemented as one of fieldtrip's high-level functions, but could be done by hand. One possibility is to use source analysis to identify regions of interest, which can then be used as "virtual electrodes" for ft_freqanalysis and ft_connectivityanalysis, just as the real electrodes in sensor space data. In order for that to work, you need to reconstruct single trial source activity at your ROIs. How this is done depends on the method you use for source analysis. There are some recent postings where a method is described for an LCMV beamformer. Hope this helps, Gregor cfg_tfr = []; cfg_tfr.output = 'fourier'; cfg_tfr.channel = 'all'; cfg_tfr.method = 'mtmconvol' cfg_tfr.taper = 'hanning' cfg_tfr.toi = -0.6:0.02:1 cfg_tfr.foi = [8 9 10 11 12]; cfg_tfr.t_ftimwin = 7./cfg_tfr.foi; cfg_tfr.channelcmb = {'EEG', 'EEG'} freq_output = ft_freqanalysis(cfg_tfr,data); cfg_con = []; cfg_con.method = 'plv'; plv = ft_connectivityanalysis(cfg_con, freq_output); -- Dr. rer. nat. Gregor Volberg ( mailto:gregor.volberg at psychologie.uni-regensburg.de ) University of Regensburg Institute for Experimental Psychology 93040 Regensburg, Germany Tel: +49 941 943 3862 Fax: +49 941 943 3233 http://www.psychologie.uni-regensburg.de/Greenlee/team/volberg/volberg.html >>> sibylle 4/7/2011 12:55 PM >>> Dear Fieldtrippers, I have a couple of question and I hope someone can help me: How is it possible to compute plv (for freq data)? As far as I can remember there used to be an option within ft_sourcedescriptives, which seems to have disappeared. How can one use plv to determine connectivity in source space? Thanks a lot & best wishes, Sibylle _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip -------------- next part -------------- An HTML attachment was scrubbed... URL: From grigu at cbs.mpg.de Thu Apr 7 15:19:17 2011 From: grigu at cbs.mpg.de (Maren Grigutsch) Date: Thu, 07 Apr 2011 15:19:17 +0200 Subject: [FieldTrip] plv and sourceanalysis In-Reply-To: <5AADFF53-1C6A-4541-A21E-DF462587EB20@donders.ru.nl> References: <0EA26325-41FA-4669-A95D-A643F2D8F84F@psy.gla.ac.uk> <5AADFF53-1C6A-4541-A21E-DF462587EB20@donders.ru.nl> Message-ID: <4D9DB9D5.1000000@cbs.mpg.de> jan-mathijs schoffelen wrote: > Dear Stan, > > Here is my take on it: > >> Speaking of plv, two weeks ago I sent out a question regarding plv, >> but I don't recall getting any responses. My questions were: >> >> 1) By ignoring the phasor magnitudes when summing over trials, isn't >> plv noisier than standard coherence that includes magnitudes? >> > > Yes Yes, if your signals are coherent. But I would not say that plv and coherence are just two different measures for the same thing. There exist dynamic regimes where only the phases of oscillators are coupled and the amplitudes are not. This type of coupling can be detected by measuring plv but not by computing coherence. > > >> 2) By including the real part isn't plv often dominated by volume >> conduction that can be avoided by just looking at the imaginary part >> of coherence (sadly the imaginary part may be hard to interpret and >> it ignores the non-volume conducting contributions to the real part). > > I agree. What's the question here? > > Best wishes, > > Jan-Mathijs > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip -- Max Planck Institute for Human Cognitive and Brain Sciences Dipl.-Phys. Maren Grigutsch mailto:grigu at cbs.mpg.de Stephanstr.1a http://www.cbs.mpg.de 04103 Leipzig, Germany phone/fax: +49 341 9940-136/-2260 From s.mohr at psy.gla.ac.uk Thu Apr 7 16:10:12 2011 From: s.mohr at psy.gla.ac.uk (sibylle) Date: Thu, 7 Apr 2011 15:10:12 +0100 Subject: [FieldTrip] plv and sourceanalysis In-Reply-To: <6ADFF688-0149-4940-9F99-C83741BD5308@donders.ru.nl> References: <0EA26325-41FA-4669-A95D-A643F2D8F84F@psy.gla.ac.uk> <6ADFF688-0149-4940-9F99-C83741BD5308@donders.ru.nl> Message-ID: <2F46431A-C0AF-4165-BC4E-E0F36B16A1A4@psy.gla.ac.uk> Dear Jan-Mathijs, Yes indeed, it is freq-data (preprocessed by ft_freqanalysis). Apologies for the confusion. Subsequently, we localized the effects using ft_sourceanalysis (cfg.method = 'dics') and identified regions of interest, which I'd like to use now for the connectivityanalysis I assume in order to use plv I would need to run ft_connectivityanalysis at the freq-level. Anyway, thanks a lot for your help! I will have a look at the ft_connectivityanalysis options. Thanks again & best wishes, Sibylle On 7 Apr 2011, at 13:28, jan-mathijs schoffelen wrote: > Dear Sibylle, > > You confuse me a bit. You mention ft_sourcedescriptives in > combination with freq data. Do you mean that you have source-level > data in the frequency domain, or do you have freq-data, as in sensor > level data having been processed by ft_freqanalysis? In the former > case, I do not recall that ft_sourcedescriptives could compute a > plv. In the latter case: it was indeed supported by > ft_freqdescriptives. > A while ago we moved the functionality of ft_freqdescriptives > dealing with coherence/plv etc to ft_connectivityanalysis. So I'd > suggest to have a look there. Also, I think it should be possible to > use ft_connectivityanalysis to compute source level plv, but this > may still need some tweaking. > > Best wishes, > > Jan-Mathijs > > > On Apr 7, 2011, at 12:55 PM, sibylle wrote: > >> Dear Fieldtrippers, >> >> I have a couple of question and I hope someone can help me: >> How is it possible to compute plv (for freq data)? >> As far as I can remember there used to be an option within >> ft_sourcedescriptives, which seems to have disappeared. >> How can one use plv to determine connectivity in source space? >> >> Thanks a lot & best wishes, >> >> Sibylle >> >> >> _______________________________________________ >> fieldtrip mailing list >> fieldtrip at donders.ru.nl >> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > > Dr. J.M. (Jan-Mathijs) Schoffelen > Donders Institute for Brain, Cognition and Behaviour, > Centre for Cognitive Neuroimaging, > Radboud University Nijmegen, The Netherlands > J.Schoffelen at donders.ru.nl > Telephone: 0031-24-3614793 > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip -------------- next part -------------- An HTML attachment was scrubbed... URL: From s.mohr at psy.gla.ac.uk Thu Apr 7 16:20:23 2011 From: s.mohr at psy.gla.ac.uk (sibylle) Date: Thu, 7 Apr 2011 15:20:23 +0100 Subject: [FieldTrip] Antw: plv and sourceanalysis In-Reply-To: <4D9DD3CD0200005700008F9F@gwsmtp1.uni-regensburg.de> References: <0EA26325-41FA-4669-A95D-A643F2D8F84F@psy.gla.ac.uk> <4D9DD3CD0200005700008F9F@gwsmtp1.uni-regensburg.de> Message-ID: Dear Gregor, I think that is exactly what I was looking for! Thanks a lot for your fast reply, this is really helpful :) Actually, I already ran ft_sourceanalysis (using DICS) to identify regions of interest. I will have a look at the LCMV beamformer postings you've recommended. Best wishes, Sibylle On 7 Apr 2011, at 14:10, Gregor Volberg wrote: > Dear Sybille, > > the plv option is now within ft_connectivityanalysis. I was > successful with the code given below (ft_freqanalysis changed a bit > in newer versions of fieldtrip so there might be some small > corrections necessary). As much as I know, a plv analysis on source > activity is not implemented as one of fieldtrip's high-level > functions, but could be done by hand. One possibility is to use > source analysis to identify regions of interest, which can then be > used as "virtual electrodes" for ft_freqanalysis and > ft_connectivityanalysis, just as the real electrodes in sensor space > data. In order for that to work, you need to reconstruct single > trial source activity at your ROIs. How this is done depends on the > method you use for source analysis. There are some recent postings > where a method is described for an LCMV beamformer. > Hope this helps, > Gregor > > > cfg_tfr = []; > cfg_tfr.output = 'fourier'; > cfg_tfr.channel = 'all'; > cfg_tfr.method = 'mtmconvol' > cfg_tfr.taper = 'hanning' > cfg_tfr.toi = -0.6:0.02:1 > cfg_tfr.foi = [8 9 10 11 12]; > cfg_tfr.t_ftimwin = 7./cfg_tfr.foi; > cfg_tfr.channelcmb = {'EEG', 'EEG'} > freq_output = ft_freqanalysis(cfg_tfr,data); > > cfg_con = []; > cfg_con.method = 'plv'; > plv = ft_connectivityanalysis(cfg_con, freq_output); > > > > > > > -- > Dr. rer. nat. Gregor Volberg > ( mailto:gregor.volberg at psychologie.uni-regensburg.de ) > University of Regensburg > Institute for Experimental Psychology > 93040 Regensburg, Germany > Tel: +49 941 943 3862 > Fax: +49 941 943 3233 > http://www.psychologie.uni-regensburg.de/Greenlee/team/volberg/volberg.html > > > >>> sibylle 4/7/2011 12:55 PM >>> > Dear Fieldtrippers, > > I have a couple of question and I hope someone can help me: > How is it possible to compute plv (for freq data)? > As far as I can remember there used to be an option within > ft_sourcedescriptives, which seems to have disappeared. > How can one use plv to determine connectivity in source space? > > Thanks a lot & best wishes, > > Sibylle > > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip -------------- next part -------------- An HTML attachment was scrubbed... URL: From amrgermany at yahoo.com Fri Apr 8 17:48:50 2011 From: amrgermany at yahoo.com (Amr Ayoub) Date: Fri, 8 Apr 2011 16:48:50 +0100 (BST) Subject: [FieldTrip] =?iso-8859-1?q?_Phd_and_Post-Doc-Positions_in_T=FCbin?= =?iso-8859-1?q?gen_Germany?= Message-ID: <623810.1342.qm@web29006.mail.ird.yahoo.com> Dear all, Prof. Jan Born is offering Phd and Post-Doctoral positions in Tuebingen. Please find the attatched two announcements for details. Thank you, Amr Ayoub -- Institut fuer Neuroendokrinologie Universitaetsklinikum Schleswig-Holstein Ratzeburger Allee 160, Bldg. 50.1 23538 Luebeck Germany Tel: +49 (0)451-500 3642 Fax: +49 (0)451-500 3640 Email: ayoub at kfg.uni-luebeck.de -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: Post-doctoral position 2011.doc Type: application/msword Size: 27648 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: Vacancy_Tuebingen_Germany.pdf Type: application/pdf Size: 7416 bytes Desc: not available URL: From recasensmarc at gmail.com Fri Apr 8 19:49:08 2011 From: recasensmarc at gmail.com (Marc Recasens) Date: Fri, 08 Apr 2011 19:49:08 +0200 Subject: [FieldTrip] Source reconstruction and NAI In-Reply-To: References: Message-ID: <4D9F4A94.8050106@gmail.com> Thank you Jan-Mathijs, I actually did not think about that... However, I did this just to remove the central blobs, independently of the effect it may cause in the different conditions. My aim is to use montecarlo non-parametric statistics afterwards to localize the sources. Don't you think there's gonna be a huge difference between nai-normalized and non-normalized datasets? Thanks again! El 07/04/2011 14:23, jan-mathijs schoffelen escribió: > Dear Marc, > > It seems from your question that you are interested in single trial > reconstructed time series. If your purpose is to do a statistical > comparison across a set of conditions I would not do a noise > normalization at all. You mention that you used a spatial filter > common to the three conditions. As a consequence, the estimate of the > noise will be independent of the condition, so any normalization you > would apply just leads to a scaling of the data, and will not change > the outcome of your statistical test. > Yet, I understand that it sometimes makes sense to do a normalization > in order to be able to make a sensible visualization of the data (i.e. > removing the big central blob). Also, in this case I would compute a > descriptive statistic across the conditions, rather than normalizing > with an estimate of the projected noise (which in FieldTrip is rather > rudimentary because it assumes the noise to be spatially white). You > could for example compute an F-value from a one-factor, three level > anova, or do a pairwise comparison of conditions using a t-test. > Another alternative (which does not affect your statistical test > either), is to work with norm-normalized leadfields. This will take > away the blob in the centre of the volume, and facilitates visualization. > > Best wishes, > > Ja-Mathijs > > > On Apr 5, 2011, at 6:54 PM, Marc Recasens wrote: > >> Dear all, >> >> As far as I know it is possible to reconstruct the time-course of the >> sources (obtained using sourceanalysis) by projecting/multiplying the >> filter-weights on the data. >> In my case, the specific code I am using is: >> >> for i=1:nvoxels(inside) >> >> for tr=1:ntrials >> >> >> ts(tr,:)=(source.avg.ori{source.inside(i)}(1,:)*source.avg.filter{source.inside(i)}*data2{condit}.trial{tr}); >> >> end >> >> datvx(i,:,:)= single_trial_time_course >> >> end >> >> I used a common filter with 3 different conditions, thus I think this >> is the only way I have to reconstruct the activity for one of the >> conditions. >> My Question is about how to apply the NAI normalization here. Can I >> just divide the output of the source reconstruction by the projected >> noise of the filter? I am tempted to do something like that >> >> datvx(i,:,:)= single_trial_time_course ./ >> repmat(noise(inside),[size(ts,1), size(ts,2)] >> >> That is, I divide the power by the noise estimate (for each voxel) in >> every trial and time-point. Could anyone tell me whether this is a >> correct way to procedure? Any other workaround? >> >> >> Thanks in advance! >> >> -- >> Marc Recasens >> Tel.: +34 639 24 15 98 >> >> _______________________________________________ >> fieldtrip mailing list >> fieldtrip at donders.ru.nl >> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > > Dr. J.M. (Jan-Mathijs) Schoffelen > Donders Institute for Brain, Cognition and Behaviour, > Centre for Cognitive Neuroimaging, > Radboud University Nijmegen, The Netherlands > J.Schoffelen at donders.ru.nl > Telephone: 0031-24-3614793 > > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip -- Marc Recasens Tel.: +34 639 24 15 98 -------------- next part -------------- An HTML attachment was scrubbed... URL: From yuvharpaz at gmail.com Fri Apr 8 21:09:01 2011 From: yuvharpaz at gmail.com (Yuval Harpaz) Date: Fri, 8 Apr 2011 22:09:01 +0300 Subject: [FieldTrip] Source reconstruction and NAI In-Reply-To: <4D9F4A94.8050106@gmail.com> References: <4D9F4A94.8050106@gmail.com> Message-ID: Dear Marc If you do normalize every condition it may be better to normalize all conditions to one baseline. this way differences between conditions will not result from differences On 8 April 2011 20:49, Marc Recasens wrote: > Thank you Jan-Mathijs, > I actually did not think about that... > However, I did this just to remove the central blobs, independently of the > effect it may cause in the different conditions. > > My aim is to use montecarlo non-parametric statistics afterwards to > localize the sources. Don't you think there's gonna be a huge difference > between nai-normalized and non-normalized datasets? > yes, they are not comarable. before normlization the scale is very small (say 10^ -13) and after it is a ratio, say 1.8. > > > Thanks again! > > > > El 07/04/2011 14:23, jan-mathijs schoffelen escribió: > > Dear Marc, > > It seems from your question that you are interested in single trial > reconstructed time series. If your purpose is to do a statistical comparison > across a set of conditions I would not do a noise normalization at all. You > mention that you used a spatial filter common to the three conditions. As a > consequence, the estimate of the noise will be independent of the condition, > so any normalization you would apply just leads to a scaling of the data, > and will not change the outcome of your statistical test. > Yet, I understand that it sometimes makes sense to do a normalization in > order to be able to make a sensible visualization of the data (i.e. removing > the big central blob). Also, in this case I would compute a descriptive > statistic across the conditions, rather than normalizing with an estimate of > the projected noise (which in FieldTrip is rather rudimentary because it > assumes the noise to be spatially white). You could for example compute an > F-value from a one-factor, three level anova, or do a pairwise comparison of > conditions using a t-test. > Another alternative (which does not affect your statistical test either), > is to work with norm-normalized leadfields. This will take away the blob in > the centre of the volume, and facilitates visualization. > > Best wishes, > > Ja-Mathijs > > > On Apr 5, 2011, at 6:54 PM, Marc Recasens wrote: > > Dear all, > > As far as I know it is possible to reconstruct the time-course of the > sources (obtained using sourceanalysis) by projecting/multiplying the > filter-weights on the data. > In my case, the specific code I am using is: > > for i=1:nvoxels(inside) > > for tr=1:ntrials > > > ts(tr,:)=(source.avg.ori{source.inside(i)}(1,:)*source.avg.filter{source.inside(i)}*data2{condit}.trial{tr}); > > end > > datvx(i,:,:)= single_trial_time_course > > end > I used a common filter with 3 different conditions, thus I think this is > the only way I have to reconstruct the activity for one of the conditions. > My Question is about how to apply the NAI normalization here. Can I just > divide the output of the source reconstruction by the projected noise of the > filter? I am tempted to do something like that > > datvx(i,:,:)= single_trial_time_course ./ > repmat(noise(inside),[size(ts,1), size(ts,2)] > > That is, I divide the power by the noise estimate (for each voxel) in > every trial and time-point. Could anyone tell me whether this is a correct > way to procedure? Any other workaround? > > > Thanks in advance! > > -- > Marc Recasens > Tel.: +34 639 24 15 98 > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > > > Dr. J.M. (Jan-Mathijs) Schoffelen > Donders Institute for Brain, Cognition and Behaviour, > Centre for Cognitive Neuroimaging, > Radboud University Nijmegen, The Netherlands > J.Schoffelen at donders.ru.nl > Telephone: 0031-24-3614793 > > > _______________________________________________ > fieldtrip mailing listfieldtrip at donders.ru.nlhttp://mailman.science.ru.nl/mailman/listinfo/fieldtrip > > > > -- > Marc Recasens > Tel.: +34 639 24 15 98 > > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > -- Y.Harpaz a link to the BIU MEG lab: http://faculty.biu.ac.il/~goldsa/index.html " Why, Dan," ask the people in Artificial Intelligence, "do you waste your time conferring with those neuroscientists? They wave their hands about information processing and worry about where it happens, and which neurotransmitters are involved, and all those boring facts, but they haven't a clue about the computational requirements of higher cognitive functions." "Why," ask the neuroscientists, "do you waste your time on the fantasies of Artificial Intelligence? They just invent whatever machinery they want, and say unpardonably ignorant things about the brain." The cognitive psychologists, meanwhile, are accused of concocting models with neither biological plausibility nor proven computational powers; the anthropologists wouldn't know a model if they saw one, and the philosophers, as we all know, just take in each other's laundry, warning about confusions they themselves have created, in an arena bereft of both data and empirically testable theories. With so many idiots working on the problem, no wonder consciousness is still a mystery.* Philosopher Daniel Dennet, consciousness explained, pp. 225* -------------- next part -------------- An HTML attachment was scrubbed... URL: From yuvharpaz at gmail.com Fri Apr 8 21:10:59 2011 From: yuvharpaz at gmail.com (Yuval Harpaz) Date: Fri, 8 Apr 2011 22:10:59 +0300 Subject: [FieldTrip] Source reconstruction and NAI In-Reply-To: References: <4D9F4A94.8050106@gmail.com> Message-ID: oops, missing words below in red On 8 April 2011 22:09, Yuval Harpaz wrote: > Dear Marc > If you do normalize every condition it may be better to normalize all > conditions to one baseline. this way differences between conditions will not > result from differences > between the baselines > > On 8 April 2011 20:49, Marc Recasens wrote: > >> Thank you Jan-Mathijs, >> I actually did not think about that... >> However, I did this just to remove the central blobs, independently of the >> effect it may cause in the different conditions. >> >> My aim is to use montecarlo non-parametric statistics afterwards to >> localize the sources. Don't you think there's gonna be a huge difference >> between nai-normalized and non-normalized datasets? >> > yes, they are not comarable. before normlization the scale is very small > (say 10^ -13) and after it is a ratio, say 1.8. > >> >> >> Thanks again! >> >> >> >> El 07/04/2011 14:23, jan-mathijs schoffelen escribió: >> >> Dear Marc, >> >> It seems from your question that you are interested in single trial >> reconstructed time series. If your purpose is to do a statistical comparison >> across a set of conditions I would not do a noise normalization at all. You >> mention that you used a spatial filter common to the three conditions. As a >> consequence, the estimate of the noise will be independent of the condition, >> so any normalization you would apply just leads to a scaling of the data, >> and will not change the outcome of your statistical test. >> Yet, I understand that it sometimes makes sense to do a normalization in >> order to be able to make a sensible visualization of the data (i.e. removing >> the big central blob). Also, in this case I would compute a descriptive >> statistic across the conditions, rather than normalizing with an estimate of >> the projected noise (which in FieldTrip is rather rudimentary because it >> assumes the noise to be spatially white). You could for example compute an >> F-value from a one-factor, three level anova, or do a pairwise comparison of >> conditions using a t-test. >> Another alternative (which does not affect your statistical test either), >> is to work with norm-normalized leadfields. This will take away the blob in >> the centre of the volume, and facilitates visualization. >> >> Best wishes, >> >> Ja-Mathijs >> >> >> On Apr 5, 2011, at 6:54 PM, Marc Recasens wrote: >> >> Dear all, >> >> As far as I know it is possible to reconstruct the time-course of the >> sources (obtained using sourceanalysis) by projecting/multiplying the >> filter-weights on the data. >> In my case, the specific code I am using is: >> >> for i=1:nvoxels(inside) >> >> for tr=1:ntrials >> >> >> ts(tr,:)=(source.avg.ori{source.inside(i)}(1,:)*source.avg.filter{source.inside(i)}*data2{condit}.trial{tr}); >> >> end >> >> datvx(i,:,:)= single_trial_time_course >> >> end >> I used a common filter with 3 different conditions, thus I think this is >> the only way I have to reconstruct the activity for one of the conditions. >> My Question is about how to apply the NAI normalization here. Can I just >> divide the output of the source reconstruction by the projected noise of the >> filter? I am tempted to do something like that >> >> datvx(i,:,:)= single_trial_time_course ./ >> repmat(noise(inside),[size(ts,1), size(ts,2)] >> >> That is, I divide the power by the noise estimate (for each voxel) in >> every trial and time-point. Could anyone tell me whether this is a correct >> way to procedure? Any other workaround? >> >> >> Thanks in advance! >> >> -- >> Marc Recasens >> Tel.: +34 639 24 15 98 >> >> _______________________________________________ >> fieldtrip mailing list >> fieldtrip at donders.ru.nl >> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip >> >> >> Dr. J.M. (Jan-Mathijs) Schoffelen >> Donders Institute for Brain, Cognition and Behaviour, >> Centre for Cognitive Neuroimaging, >> Radboud University Nijmegen, The Netherlands >> J.Schoffelen at donders.ru.nl >> Telephone: 0031-24-3614793 >> >> >> _______________________________________________ >> fieldtrip mailing listfieldtrip at donders.ru.nlhttp://mailman.science.ru.nl/mailman/listinfo/fieldtrip >> >> >> >> -- >> Marc Recasens >> Tel.: +34 639 24 15 98 >> >> >> _______________________________________________ >> fieldtrip mailing list >> fieldtrip at donders.ru.nl >> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip >> > > > > -- > Y.Harpaz > > a link to the BIU MEG lab: > http://faculty.biu.ac.il/~goldsa/index.html > > " Why, Dan," ask the people in Artificial Intelligence, "do you waste your > time conferring with those neuroscientists? They wave their hands about > information processing and worry about where it happens, and > which neurotransmitters are involved, and all those boring facts, but > they haven't a clue about the computational requirements of higher > cognitive functions." "Why," ask the neuroscientists, "do you waste your > time on the fantasies of Artificial Intelligence? They just invent > whatever machinery they want, and say unpardonably ignorant things about the > brain." The cognitive psychologists, meanwhile, are accused of concocting > models with neither biological plausibility nor proven computational powers; > the anthropologists wouldn't know a model if they saw one, and the > philosophers, as we all know, just take in each other's laundry, warning > about confusions they themselves have created, in an arena bereft of both > data and empirically testable theories. With so many idiots working on the > problem, no wonder consciousness is still a mystery.* Philosopher Daniel > Dennet, consciousness explained, pp. 225* > > -- Y.Harpaz a link to the BIU MEG lab: http://faculty.biu.ac.il/~goldsa/index.html " Why, Dan," ask the people in Artificial Intelligence, "do you waste your time conferring with those neuroscientists? They wave their hands about information processing and worry about where it happens, and which neurotransmitters are involved, and all those boring facts, but they haven't a clue about the computational requirements of higher cognitive functions." "Why," ask the neuroscientists, "do you waste your time on the fantasies of Artificial Intelligence? They just invent whatever machinery they want, and say unpardonably ignorant things about the brain." The cognitive psychologists, meanwhile, are accused of concocting models with neither biological plausibility nor proven computational powers; the anthropologists wouldn't know a model if they saw one, and the philosophers, as we all know, just take in each other's laundry, warning about confusions they themselves have created, in an arena bereft of both data and empirically testable theories. With so many idiots working on the problem, no wonder consciousness is still a mystery.* Philosopher Daniel Dennet, consciousness explained, pp. 225* -------------- next part -------------- An HTML attachment was scrubbed... URL: From batrod at gmail.com Sat Apr 9 00:23:20 2011 From: batrod at gmail.com (Rodolphe Nenert) Date: Fri, 8 Apr 2011 17:23:20 -0500 Subject: [FieldTrip] Method montecarlo unknown Message-ID: I decided to download the last Fieldtrip version today, and i tried to run a script doing some montecarlo analysis tahta was previously working. It gave me a strange error: selected 48 channels selected 25 time bins averaging over 1 frequency bins Using the 2-D layout to determine the neighbours ??? Error using ==> ft_neighbourselection at 144 Method 'montecarlo' not known Error in ==> statistics_wrapper at 241 cfg.neighbours = ft_neighbourselection(cfg,varargin{1}); Error in ==> ft_freqstatistics at 127 [stat, cfg] = statistics_wrapper(cfg, varargin{:}); Error in ==> Alpha_stats_montecarlo at 92 [stat] = ft_freqstatistics(cfg, TFRhann_base.data{var1,1:16}, TFRhann_base.data{var2,1:16}); Apparently, when it calls the neighbourselection function, it gives the cfg i specify with cfg.method = 'montecarlo'. Or it should be 'distance' or 'triangulation'. Am i missing something relative to the latest Fieldtrip version? I looked in the documentation but it seems the code hasn' t change. Best regards, Rodolphe Nenert, PhD -------------- next part -------------- An HTML attachment was scrubbed... URL: From jm.horschig at donders.ru.nl Sat Apr 9 12:41:20 2011 From: jm.horschig at donders.ru.nl (=?ISO-8859-1?Q?=22J=F6rn_M=2E_Horschig=22?=) Date: Sat, 09 Apr 2011 12:41:20 +0200 Subject: [FieldTrip] Method montecarlo unknown In-Reply-To: References: Message-ID: <4DA037D0.6070709@donders.ru.nl> Hi Rodolphe, this bug was introduced on the Friday release, since I changed something in ft_neighbourselection (my apologies). Saskia fixed this bug a few minutes ago. So please update your SVN respository, or use the version from Thursday. The new bugfix should be included in the FTP version from tomorrow on. Best, Jörn On 4/9/2011 12:23 AM, Rodolphe Nenert wrote: > I decided to download the last Fieldtrip version today, and i tried to > run a script doing some montecarlo analysis tahta was previously > working. It gave me a strange error: > > selected 48 channels > selected 25 time bins > averaging over 1 frequency bins > Using the 2-D layout to determine the neighbours > ??? Error using ==> ft_neighbourselection at 144 > Method 'montecarlo' not known > > Error in ==> statistics_wrapper at 241 > cfg.neighbours = ft_neighbourselection(cfg,varargin{1}); > > Error in ==> ft_freqstatistics at 127 > [stat, cfg] = statistics_wrapper(cfg, varargin{:}); > > Error in ==> Alpha_stats_montecarlo at 92 > [stat] = ft_freqstatistics(cfg, TFRhann_base.data{var1,1:16}, > TFRhann_base.data{var2,1:16}); > > > Apparently, when it calls the neighbourselection function, it gives > the cfg i specify with cfg.method = 'montecarlo'. Or it should be > 'distance' or 'triangulation'. > Am i missing something relative to the latest Fieldtrip version? > I looked in the documentation but it seems the code hasn' t change. > > Best regards, > > > Rodolphe Nenert, PhD > > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip -- Jörn M. Horschig PhD Student Donders Institute for Brain, Cognition and Behaviour Centre for Cognitive Neuroimaging Radboud University Nijmegen P.O. Box 9101 NL-6500 HB Nijmegen The Netherlands Contact: E-Mail: jm.horschig at donders.ru.nl Tel: +31-(0)24-36-68493 Web: http://www.ru.nl/donders Visiting address: Trigon, room 2.30 Kapitelweg 29 NL-6525 EN Nijmegen The Netherlands -------------- next part -------------- An HTML attachment was scrubbed... URL: From sherrykhan78 at gmail.com Sat Apr 9 15:41:48 2011 From: sherrykhan78 at gmail.com (Sheraz Khan) Date: Sat, 9 Apr 2011 09:41:48 -0400 Subject: [FieldTrip] Coherence Difference Message-ID: Dear fieldtrippers I am very new to fieldtrip, I need to find "Coherence (one meg channel to all MEG channel in sensor space) Differences between two groups in four condition" . Please help in pointing which FT statistics function to used and how to setup CFG for it. Thanks Regards Sheraz Khan -------------- next part -------------- An HTML attachment was scrubbed... URL: From A.Stancak at liverpool.ac.uk Sun Apr 10 21:01:28 2011 From: A.Stancak at liverpool.ac.uk (Stancak, Andrej) Date: Sun, 10 Apr 2011 20:01:28 +0100 Subject: [FieldTrip] possible designs in ft_freqstatistics Message-ID: <0813B54A9D2C494CACBD693C6A2D4D4C14761F95AF@STAFFMBX2.livad.liv.ac.uk> Dear community, we would like to use the ft_freqstatistics function to test differences between 3 conditions (within subjects, 1-way ANOVA), and also another design involving 2 groups of subjects and 2 types of visual stimulation (mixed 2x2 ANOVA). I was able to find examples for comparisons of 2 conditions and wonder if other designs are also possible and where could I find examples of "cfg.design" specification for such statistical models. Best regards Andrej Stancak Andrej Stancak, PhD. Professor for normal physiology Senior lecturer in psychology School of Psychology Eleanor Rathbone Building Bedford Street South L69 7ZA Liverpool United Kingdom Phone: 0044 0151 7946951 E-mail: a.stancak at liverpool.ac.uk (primary) stancak at lf3.cuni.cz (secondary) Office hours: Mo 10-12, Wed 10-12 From manjebrinkhuis at gmail.com Mon Apr 11 20:17:46 2011 From: manjebrinkhuis at gmail.com (Manje Brinkhuis) Date: Mon, 11 Apr 2011 20:17:46 +0200 Subject: [FieldTrip] fieldtrip Digest, Vol 5, Issue 10 In-Reply-To: References: Message-ID: Op 10 apr. 2011 12:00 schreef het volgende: > Send fieldtrip mailing list submissions to > fieldtrip at donders.ru.nl > > To subscribe or unsubscribe via the World Wide Web, visit > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > or, via email, send a message with subject or body 'help' to > fieldtrip-request at donders.ru.nl > > You can reach the person managing the list at > fieldtrip-owner at donders.ru.nl > > When replying, please edit your Subject line so it is more specific > than "Re: Contents of fieldtrip digest..." > > > Today's Topics: > > 1. Re: Method montecarlo unknown (J?rn M. Horschig) > 2. Coherence Difference (Sheraz Khan) > > > ---------------------------------------------------------------------- > > Message: 1 > Date: Sat, 09 Apr 2011 12:41:20 +0200 > From: "J?rn M. Horschig" > To: fieldtrip at donders.ru.nl > Subject: Re: [FieldTrip] Method montecarlo unknown > Message-ID: <4DA037D0.6070709 at donders.ru.nl> > Content-Type: text/plain; charset="iso-8859-1"; Format="flowed" > > Hi Rodolphe, > > this bug was introduced on the Friday release, since I changed something > in ft_neighbourselection (my apologies). Saskia fixed this bug a few > minutes ago. So please update your SVN respository, or use the version > from Thursday. The new bugfix should be included in the FTP version from > tomorrow on. > > Best, > J?rn > > On 4/9/2011 12:23 AM, Rodolphe Nenert wrote: >> I decided to download the last Fieldtrip version today, and i tried to >> run a script doing some montecarlo analysis tahta was previously >> working. It gave me a strange error: >> >> selected 48 channels >> selected 25 time bins >> averaging over 1 frequency bins >> Using the 2-D layout to determine the neighbours >> ??? Error using ==> ft_neighbourselection at 144 >> Method 'montecarlo' not known >> >> Error in ==> statistics_wrapper at 241 >> cfg.neighbours = ft_neighbourselection(cfg,varargin{1}); >> >> Error in ==> ft_freqstatistics at 127 >> [stat, cfg] = statistics_wrapper(cfg, varargin{:}); >> >> Error in ==> Alpha_stats_montecarlo at 92 >> [stat] = ft_freqstatistics(cfg, TFRhann_base.data{var1,1:16}, >> TFRhann_base.data{var2,1:16}); >> >> >> Apparently, when it calls the neighbourselection function, it gives >> the cfg i specify with cfg.method = 'montecarlo'. Or it should be >> 'distance' or 'triangulation'. >> Am i missing something relative to the latest Fieldtrip version? >> I looked in the documentation but it seems the code hasn' t change. >> >> Best regards, >> >> >> Rodolphe Nenert, PhD >> >> >> _______________________________________________ >> fieldtrip mailing list >> fieldtrip at donders.ru.nl >> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > > > -- > J?rn M. Horschig > PhD Student > Donders Institute for Brain, Cognition and Behaviour > Centre for Cognitive Neuroimaging > Radboud University Nijmegen > > P.O. Box 9101 > NL-6500 HB Nijmegen > The Netherlands > > Contact: > E-Mail: jm.horschig at donders.ru.nl > Tel: +31-(0)24-36-68493 > Web: http://www.ru.nl/donders > > Visiting address: > Trigon, room 2.30 > Kapitelweg 29 > NL-6525 EN Nijmegen > The Netherlands > > -------------- next part -------------- > An HTML attachment was scrubbed... > URL: < http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20110409/ebf855fb/attachment-0001.html > > > ------------------------------ > > Message: 2 > Date: Sat, 9 Apr 2011 09:41:48 -0400 > From: Sheraz Khan > To: fieldtrip at donders.ru.nl > Subject: [FieldTrip] Coherence Difference > Message-ID: > Content-Type: text/plain; charset="iso-8859-1" > > Dear fieldtrippers > > I am very new to fieldtrip, I need to find "Coherence (one meg channel to > all MEG channel in sensor space) Differences between two groups in four > condition" . > > Please help in pointing which FT statistics function to used and how to > setup CFG for it. > > Thanks > > Regards > > Sheraz Khan > -------------- next part -------------- > An HTML attachment was scrubbed... > URL: < http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20110409/65517355/attachment-0001.html > > > ------------------------------ > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > > End of fieldtrip Digest, Vol 5, Issue 10 > **************************************** -------------- next part -------------- An HTML attachment was scrubbed... URL: From Jan.Hirschmann at med.uni-duesseldorf.de Tue Apr 12 11:07:06 2011 From: Jan.Hirschmann at med.uni-duesseldorf.de (Jan.Hirschmann at med.uni-duesseldorf.de) Date: Tue, 12 Apr 2011 11:07:06 +0200 Subject: [FieldTrip] I think you solved the problem In-Reply-To: References: Message-ID: <72E993C35FB11743B79FF9286E5B6D8B02676142@Mail2-UKD.VMED.UKD> Dear fieldtrip experts, I have two questions regarding head model creation. As noted on this thread, the volumesegment function was updated and I tested it for our Neuromag data. The segmentation is performed, but unfortunately it is not aligned with the MRI in my case. Here is the code I am using, the fieldtrip is from 9th April 2011. %read mri mri = ft_read_mri(subject_files.fiff_mri); mri.anatomy=double(mri.anatomy); %these are the fiducials for this subject taken from the Neuromag GUI for coregistration cfg=[]; cfg.fiducial.rpa=[136.35 142.80 31.96]; cfg.fiducial.nas=[47.84 101.80 100.10]; cfg.fiducial.lpa=[139.22 146.17 162.69]; %define the head coordinate system according to CTF conventions cfg.method='fiducial'; real_mri=ft_volumerealign(cfg,mri); %segment cfg = []; cfg.template = '/data/apps/spm/spm8/templates/T1.nii'; cfg.coordinates = 'ctf'; cfg.keepintermediate = 'no'; segmentedmri = ft_volumesegment(cfg, real_mri); %plot white matter test=segmentedmri; test.anatomy=real_mri.anatomy; cfg=[]; cfg.funparameter='white'; ft_sourceplot(cfg,test); %see attached picture The other issue regards back-transformation from CTF to Neuromag coordinates, which is necessary to make the head model fit the sensors. My idea was to create an appropriate transformation matrix like this. cd /net/avidya/storage/home/jan/fieldtrip-20110409/private ctfmat=headcoordinates(nas,lpa,rpa,'ctf'); nmmat=headcoordinates(nas,lpa,rpa,'neuromag'); ctf_to_nm=nmmat/ctfmat; And then to use it on the head model to bring it back into Neuromag coordinates: %create single shell, realistic headmodel cfg = []; hdm = ft_prepare_singleshell(cfg,segmentedmri); % transformation of headmodel into Neuromag space hdm.bnd.pnt=warp_apply(ctf_to_nm,hdm.bnd.pnt,'homogeneous'); Does this survive a sanity check? Best regards and thanks a lot, Jan ________________________________ Von: fieldtrip-bounces at donders.ru.nl [mailto:fieldtrip-bounces at donders.ru.nl] Im Auftrag von Jen Whitman Gesendet: Montag, 28. Februar 2011 22:32 An: Email discussion list for the FieldTrip project Betreff: [FieldTrip] I think you solved the problem I just checked, and when I re-ran my segmentation script with the new Fieldtrip in order to use an spm8 template image, coordinates got reversed. When I take out the calls to flipdim, they look fine (see attached screenshots). That certainly explains the meaningless results I was getting! Thanks for figuring that out, Jen On Mon, Feb 28, 2011 at 12:36 PM, jan-mathijs schoffelen < jan.schoffelen at donders.ru.nl> wrote: Hi Jen, At first glance I have a comment on your script. You may need to explicitly check the alignment of your segmented volume and the original anatomy. A while a go some changes were made to ft_volumesegment, taking away the need to do the flipdim(flipdim... operations. I have posted this on the discussion list last January, but you may not have noticed. Anyway, if you now have used a recent version of FieldTrip for your segmentation both the location of your dipole grid, and the volume conductor model will not be adequately coregistered with the data, which may lead to funky results to begin with. That's most likely not related to the filetype in which the volumes are saved for later use. Best wishes, Jan-Mathijs On Feb 28, 2011, at 8:59 PM, Jen Whitman wrote: Hello Jan, When calling volumesegment, I specified 'ctf' as the coordinate system. The function I wrote to call volumesegment and prepare_singleshell for each subject and save the results is pasted below, with a couple of comments added for clarity. Over the weekend I tried specifying the coordinate system in the call to ft_volumenormalise as 'ctf' rather than 'spm', and commented out all the lines that said cfg.spmversion = 'spm8'; before calling a function. However, that created worse results, as each plot involved stripes of activation and empty voxels, suggesting that 'ctf' was not the correct coordinate system to specify. Thanks for the attached script. Looking in that the comments in that, I suspect that the solution to my problems will be to specify my filetype as nifti_img rather than nifti. I'll let you know how that goes. Jen ------------------------------------------------------------------------ ------------------------------------ % the variable subj is simply a string consisting of a subject number (e.g. 's05') which can be a folder name or part of a filename function [vol mri segmentedmri segmentedmriF]=call_volume_segment_function_spm8(subj) cfg.spmversion = 'spm8'; cfg.template = '/home/woodwardlab/spm8/templates/EPI.nii'; %cfg.template='/home/common/matlab/spm2/templates/T1.mnc'; cfg.name=[subj '_volseg']; cfg.write='yes'; cfg.smooth='no'; cfg.coordinates='ctf'; mri=read_mri([subj '/mri/' subj 'head.mri']); % made with CTF mriConverter and mriViewer software, after fiducials were marked segmentedmri = volumesegment(cfg, mri); segmentedmriF = segmentedmri; segmentedmriF.gray = flipdim(flipdim(flipdim(segmentedmriF.gray,3),2),1); segmentedmriF.white = flipdim(flipdim(flipdim(segmentedmriF.white,3),2),1); segmentedmriF.csf = flipdim(flipdim(flipdim(segmentedmriF.csf,3),2),1); segmentedmriF.transform = mri.transform; segmentedmriF.anatomy = mri.anatomy; cfg = []; cfg.spmversion = 'spm8'; vol = prepare_singleshell(cfg, segmentedmriF); eval(['save ' subj '/meg/mrisegmented.mat mri segmentedmri segmentedmriF vol']) On Sat, Feb 26, 2011 at 5:26 AM, jan-mathijs schoffelen < jan.schoffelen at donders.ru.nl> wrote: Dear Jen, I do not manage to reproduce your issue, when only focussing on the ft_volumewrite and visualization part of your pipeline. See attached script, and yet an updated version of ft_volumewrite which you need to (hopefully) draw the same conclusion as I did. Yet, I only now realize that your question may pertain to the entire pipeline. It could be that something is going wrong there. I only see now that in the part of your script of which you reported that it gave 'good' results, you specify cfg.coordinates = 'ctf' before calling ft_volumenormalise. I assume this is correct, because the coordinate system your source-reconstructed data lives in, is according to the CTF-convention, and not according to the SPM-convention. On the other hand, the template for the spatial normalization lives in the SPM-coordinate system. In order for the spatial normalization to work OK, Fieldtrip tries to convert from one coordinate system to the other (once again, this is appropriate behaviour), before doing the actual normalization. It seems that at least in the script you sent along, in the final (not working version), you specified cfg.coordinates = 'spm' prior to calling ft_volumenormalise. This is probably wrong. Another important point that should be mentioned, is that the coordinate systems in which the functional data and the anatomical data live should be the same for the ft_sourceinterpolate to make sense. In other words, if your source reconstructed images are defined on a 3D grid of positions in CTF-space, the mri.transform of your anatomy should describe a transformation from voxel to CTF-space. I think you may want to revisit step by step this part of the pipeline; I don't think the problem lies in the writing. A final possibility of course is that Mricron is misbehaving... Best, Jan-Mathijs On Feb 25, 2011, at 9:44 PM, Jen Whitman wrote: Hi Jan, I tried re-running the analysis with the new script you sent me, and the latest version of fieldtrip (since I needed ft_get_opt as well), but the spm8 images being written are still producing flawed results. It's the same problem as I mentioned briefly in my previous post. I am not getting any error messages when writing these images. Rather, my problem is that the spm8 and spm2 results from the same data ought to be identical when viewed in mricron, but they're far from it. When I use mricron to look at the results from the spm8-format images, combined across participants to create a t-image, I just get a single 'blob' spanning roughly half the brain. In contrast, when I used spm2-format previously on the same data, the t-image was much more meaningful; a posterior alpha power decrease in a set of regions corresponding to the 'task-positive network' (a network found in the results of an fMRI version of my experiment, and widely reported in the fMRI literature). This failure to replicate the spm2 results when using spm8 images from the same data leads me to suspect that something is wrong with the coordinates for spm8 format. However, after experimenting extensively with different cfg options I still haven't identified the problem. If I my structural MRIs have been saved to .mri files using CTF's MRIConverter program, which cfg options, particularly for coordinates, template images, and filetypes, should I specify before calling the ft_volumesegment, ft_prepare_singleshell, ft_sourceinterpolate, ft_volumenormalise, and ft_volumewrite functions? Or should I be calling a different set of functions now? Thanks again for your help, Jen On Thu, Feb 24, 2011 at 10:07 AM, Jen Whitman wrote: Great, thanks! I'll start the analysis with your new script today and will let you know how it works out. Jen On Thu, Feb 24, 2011 at 4:44 AM, jan-mathijs schoffelen < jan.schoffelen at donders.ru.nl> wrote: Dear Jen, I managed to reproduce your problem. The code was rather buggy and indeed ft_volumewrite did not behave as it should have. I now fixed it in the code and it should run fine now. Please find the updated file attached. It will be available on our ftp-server as of tonight. Please note that I updated the documentation, and changed the names of some of the options a bit. If you want to save your data in analyze-format, you should specify cfg.filetype = 'analyze_spm'. If you specify cfg.filetype = 'nifti', it should write out a volume to nifti-format, using SPM8. Best wishes, Jan-Mathijs On Feb 23, 2011, at 7:44 PM, Jen Whitman wrote: Dear Jan, Thanks for the quick reply. Yes, I have tried it out quite a few times now, experimenting with different settings in the cfgs. Below I'll paste the code I've been using to write images - first the code that successfully created spm2 images that produced good results, then the code used for creating nifti format images from the same data. The comments in this second part are at this point a bit of a maze of cfg options I've been changing back & forth. Any insights/suggestions regarding how to set up my cfgs to make this work would be greatly appreciated. Jen %%%%%%%% this code generated spm2-compatible images which did work (producing results that made sense). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% sourcetemp.avg.pow = (sourcetemp.avg.pow - sourcePre.avg.pow) ./ sourcePre.avg.pow; cfg = []; cfg.downsample = 2; sourcetempInt = sourceinterpolate(cfg, sourcetemp , mri); % projecting the plot onto a surface... cfg = []; cfg.coordinates = 'ctf'; cfg.template = '/home/common/matlab/spm2/templates/T1.mnc'; %this template is in MNI coordinates sourcetempIntN = volumenormalise(cfg, sourcetempInt); filename=[subj 'run' int2str(r) 'cond' int2str(cond) '_' int2str(f) 'HzWin' int2str(win) 'width750ms']; cfg=[]; cfg.parameter = 'avg.pow'; % string, describing the functional data to be processed, e.g. 'pow', 'coh' or 'nai' cfg.filename = [filename '.img']; %'testimageoutput_alphafreq'; % filename without the extension cfg.filetype = 'spm'; %'analyze', 'spm', 'vmp' or 'vmr' cfg.coordinates = 'spm'; %'spm, 'ctf' or empty for interactive (default = []) cfg.datatype = 'double'; %'float'; %'double'; %'bit1', 'uint8', 'int16', 'int32', 'float' or 'double' volumewrite(cfg, sourcetempIntN) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%% this code below hasn't worked yet... % I added cfg.spmversion = 'spm8'; % in the cfgs for the calls to ft_prepare_leadfield and ft_sourceanalysis, % and in the call to prepare_singleshell after calling volumesegment % I've also ensured that spm8 is the only spm version in my path, even in % the fieldtrip/external folder, and ensured that spm8 is installed properly % (files compiled correctly, etc..) sourcetemp.avg.pow = (sourcetemp.avg.pow - sourcePre.avg.pow) ./ sourcePre.avg.pow; filename=[subj 'run' int2str(r) 'cond' int2str(cond) '_' int2str(f) 'Hzspm8_FIXv9_Win' int2str(win) 'width750ms.img']; cfg = []; % cfg.coordinates = 'spm'; % changed for version 5 % cfg.spmversion = 'spm8'; % changed for version 5 cfg.downsample = 4; sourcetempInt = ft_sourceinterpolate(cfg, sourcetemp , mri); % projecting the plot onto a surface... cfg = []; %cfg.coordinates = 'spm'; % changed for version 5 %cfg.coordinates = 'ctf'; % changed for version 5 cfg.coordinates = 'spm'; % changed back to spm for version 9 cfg.downsample = 4; %cfg.spmversion = 'spm8'; % changed for version 6 (because this gets specified in volumewrite) cfg.template = 'Hmatrix/mask.nii.nii'; % basically equivalent to using spm8/templates/EPI.nii, except that mask.nii (produced from fmri data) has the desired voxel size % cfg.name = [filename]; % changed for version 6 %cfg.write= 'yes'; % changed for version 6 (when this was set to 'yes' there was no subsequent call to volumewrite) cfg.write= 'no'; % changed for version 6 sourcetempIntN = ft_volumenormalise(cfg, sourcetempInt); % this whole cfg and function call added for version 6 cfg=[]; % cfg.parameter = string, describing the functional data to be processed, e.g. 'pow', 'coh' or 'nai' % cfg.filename = filename without the extension % cfg.filetype = 'analyze', 'spm', 'vmp' or 'vmr' % cfg.vmpversion = 1 or 2 (default) version of the vmp-format to use % cfg.coordinates = 'spm, 'ctf' or empty for interactive (default = []) cfg.parameter='pow'; cfg.filename=filename; cfg.filetype = 'spm'; cfg.spmversion = 'SPM8'; % capitalized after first error message from vers 6 % cfg.dataformat='nifti'; % added after first error message from vers 6 % commented out after 2nd error message from vers 6 %cfg.vmpversion=2; % this is a filetype, like spm, so don't need to specify unless cfg.filetyp='vmp' cfg.coordinates='spm'; ft_volumewrite(cfg,sourcetempIntN); On Wed, Feb 23, 2011 at 7:50 AM, jan-mathijs schoffelen wrote: Dear Jen, I notice that indeed in the documentation section of ft_write_volume there is a FIXME behind nifti. Yet, nifti format seems to be supported by ft_write_volume (at least in a recent version of fieldtrip). Did you try it at all (and ran into problems) or were you held back by the FIXME statement? Could you just try it out using a recent fieldtrip function? Thanks and best wishes Jan-Mathijs On Feb 23, 2011, at 2:21 AM, Jen Whitman wrote: Hello, While writing beamformed images to spm2 format in a previous version of fieldtrip (now lost due to a computer crash), I was able to get nice-looking results; networks of brain regions consistent with existing literature. When I try to write images from the same dataset and the same analysis to spm8 format, my results (t-images computed across subjects) end up being single clusters spanning large sections of the brain (e.g. a 'blob' spanning all of one hemisphere but not the other). Unfortunately, some aspects of my planned data analyses cannot be performed on spm2 images, so I have to find a way of writing to successfully to nifti format. I just noticed that in the comments in the ft_write_volume function, which I am calling via ft_volumewrite, it says 'FIXME' next to nifti under the list of supported dataformats. Is there by any chance a patch out there for writing nifti images? Thanks! _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: misalignment.png Type: image/png Size: 105466 bytes Desc: misalignment.png URL: From jan.schoffelen at donders.ru.nl Tue Apr 12 12:10:47 2011 From: jan.schoffelen at donders.ru.nl (jan-mathijs schoffelen) Date: Tue, 12 Apr 2011 12:10:47 +0200 Subject: [FieldTrip] I think you solved the problem In-Reply-To: <72E993C35FB11743B79FF9286E5B6D8B02676142@Mail2-UKD.VMED.UKD> References: <72E993C35FB11743B79FF9286E5B6D8B02676142@Mail2-UKD.VMED.UKD> Message-ID: <7B5CA863-D143-404C-BCB9-805AA6E6E546@donders.ru.nl> Dear Jan, Apart from not being properly aligned, the segmentation looks a bit strange to me. I suspect that not everything went well here ;o). Could you try the following: specify cfg.coordsys = 'neuromag', both in your call to ft_volumerealign and in your call to ft_volumesegment. The cfg.coordinates for ft_volumesegment has to be removed (actually it is a deprecated option). The idea now is that mri-structures in fieldtrip can have a coordsys field, which allows for more transparent use of the different head coordinate system conventions. This takes away the need for intermediately coregistering the MRI in 'ctf'-convention, and would also take away your need to call headcoordinates later on. Best wishes, Jan-Mathijs On Apr 12, 2011, at 11:07 AM, wrote: > Dear fieldtrip experts, > > I have two questions regarding head model creation. As noted on this > thread, the volumesegment function was updated and I tested it for > our Neuromag data. The segmentation is performed, but unfortunately > it is not aligned with the MRI in my case. Here is the code I am > using, the fieldtrip is from 9th April 2011. > > %read mri > mri = ft_read_mri(subject_files.fiff_mri); > mri.anatomy=double(mri.anatomy); > > %these are the fiducials for this subject taken from the Neuromag > GUI for coregistration > cfg=[]; > cfg.fiducial.rpa=[136.35 142.80 31.96]; > cfg.fiducial.nas=[47.84 101.80 100.10]; > cfg.fiducial.lpa=[139.22 146.17 162.69]; > > %define the head coordinate system according to CTF conventions > cfg.method='fiducial'; > real_mri=ft_volumerealign(cfg,mri); > > %segment > cfg = []; > cfg.template = '/data/apps/spm/spm8/templates/T1.nii'; > cfg.coordinates = 'ctf'; > cfg.keepintermediate = 'no'; > segmentedmri = ft_volumesegment(cfg, real_mri); > > %plot white matter > test=segmentedmri; > test.anatomy=real_mri.anatomy; > cfg=[]; > cfg.funparameter='white'; > ft_sourceplot(cfg,test); %see attached picture > > The other issue regards back-transformation from CTF to Neuromag > coordinates, which is necessary to make the head model fit the > sensors. My idea was to create an appropriate transformation matrix > like this. > > cd /net/avidya/storage/home/jan/fieldtrip-20110409/private > ctfmat=headcoordinates(nas,lpa,rpa,'ctf'); > nmmat=headcoordinates(nas,lpa,rpa,'neuromag'); > ctf_to_nm=nmmat/ctfmat; > > > And then to use it on the head model to bring it back into Neuromag > coordinates: > > %create single shell, realistic headmodel > cfg = []; > hdm = ft_prepare_singleshell(cfg,segmentedmri); > > % transformation of headmodel into Neuromag space > hdm.bnd.pnt=warp_apply(ctf_to_nm,hdm.bnd.pnt,'homogeneous'); > > Does this survive a sanity check? > > Best regards and thanks a lot, > > Jan > > > Von: fieldtrip-bounces at donders.ru.nl [mailto:fieldtrip-bounces at donders.ru.nl > ] Im Auftrag von Jen Whitman > Gesendet: Montag, 28. Februar 2011 22:32 > An: Email discussion list for the FieldTrip project > Betreff: [FieldTrip] I think you solved the problem > > I just checked, and when I re-ran my segmentation script with the > new Fieldtrip in order to use an spm8 template image, coordinates > got reversed. When I take out the calls to flipdim, they look fine > (see attached screenshots). That certainly explains the meaningless > results I was getting! > > Thanks for figuring that out, > > Jen > > On Mon, Feb 28, 2011 at 12:36 PM, jan-mathijs schoffelen > wrote: > Hi Jen, > > At first glance I have a comment on your script. You may need to > explicitly check the alignment of your segmented volume and the > original anatomy. A while a go some changes were made to > ft_volumesegment, taking away the need to do the flipdim(flipdim... > operations. I have posted this on the discussion list last January, > but you may not have noticed. > Anyway, if you now have used a recent version of FieldTrip for your > segmentation both the location of your dipole grid, and the volume > conductor model will not be adequately coregistered with the data, > which may lead to funky results to begin with. That's most likely > not related to the filetype in which the volumes are saved for later > use. > > Best wishes, > > Jan-Mathijs > > > > On Feb 28, 2011, at 8:59 PM, Jen Whitman wrote: > > > Hello Jan, > > When calling volumesegment, I specified 'ctf' as the coordinate > system. The function I wrote to call volumesegment and > prepare_singleshell for each subject and save the results is pasted > below, with a couple of comments added for clarity. > Over the weekend I tried specifying the coordinate system in the > call to ft_volumenormalise as 'ctf' rather than 'spm', and commented > out all the lines that said cfg.spmversion = 'spm8'; before calling > a function. However, that created worse results, as each plot > involved stripes of activation and empty voxels, suggesting that > 'ctf' was not the correct coordinate system to specify. > > Thanks for the attached script. Looking in that the comments in > that, I suspect that the solution to my problems will be to specify > my filetype as nifti_img rather than nifti. I'll let you know how > that goes. > > Jen > > ------------------------------------------------------------------------------------------------------------ > % the variable subj is simply a string consisting of a subject > number (e.g. 's05') which can be a folder name or part of a filename > function [vol mri segmentedmri > segmentedmriF]=call_volume_segment_function_spm8(subj) > cfg.spmversion = 'spm8'; > cfg.template = '/home/woodwardlab/spm8/templates/EPI.nii'; > %cfg.template='/home/common/matlab/spm2/templates/T1.mnc'; > cfg.name=[subj '_volseg']; > cfg.write='yes'; > cfg.smooth='no'; > cfg.coordinates='ctf'; > mri=read_mri([subj '/mri/' subj 'head.mri']); % made with CTF > mriConverter and mriViewer software, after fiducials were marked > segmentedmri = volumesegment(cfg, mri); > segmentedmriF = segmentedmri; > segmentedmriF.gray = flipdim(flipdim(flipdim(segmentedmriF.gray,3), > 2),1); > segmentedmriF.white = flipdim(flipdim(flipdim(segmentedmriF.white,3), > 2),1); > segmentedmriF.csf = flipdim(flipdim(flipdim(segmentedmriF.csf,3), > 2),1); > segmentedmriF.transform = mri.transform; > segmentedmriF.anatomy = mri.anatomy; > cfg = []; > cfg.spmversion = 'spm8'; > vol = prepare_singleshell(cfg, segmentedmriF); > eval(['save ' subj '/meg/mrisegmented.mat mri segmentedmri > segmentedmriF vol']) > > > > On Sat, Feb 26, 2011 at 5:26 AM, jan-mathijs schoffelen > wrote: > Dear Jen, > > I do not manage to reproduce your issue, when only focussing on the > ft_volumewrite and visualization part of your pipeline. See attached > script, and yet an updated version of ft_volumewrite which you need > to (hopefully) draw the same conclusion as I did. > Yet, I only now realize that your question may pertain to the entire > pipeline. It could be that something is going wrong there. > I only see now that in the part of your script of which you reported > that it gave 'good' results, you specify cfg.coordinates = 'ctf' > before calling ft_volumenormalise. I assume this is correct, because > the coordinate system your source-reconstructed data lives in, is > according to the CTF-convention, and not according to the SPM- > convention. On the other hand, the template for the spatial > normalization lives in the SPM-coordinate system. In order for the > spatial normalization to work OK, Fieldtrip tries to convert from > one coordinate system to the other (once again, this is appropriate > behaviour), before doing the actual normalization. It seems that at > least in the script you sent along, in the final (not working > version), you specified cfg.coordinates = 'spm' prior to calling > ft_volumenormalise. This is probably wrong. > Another important point that should be mentioned, is that the > coordinate systems in which the functional data and the anatomical > data live should be the same for the ft_sourceinterpolate to make > sense. In other words, if your source reconstructed images are > defined on a 3D grid of positions in CTF-space, the mri.transform of > your anatomy should describe a transformation from voxel to CTF-space. > I think you may want to revisit step by step this part of the > pipeline; I don't think the problem lies in the writing. > A final possibility of course is that Mricron is misbehaving... > > Best, > > Jan-Mathijs > > > > > > > On Feb 25, 2011, at 9:44 PM, Jen Whitman wrote: > > > Hi Jan, > > I tried re-running the analysis with the new script you sent me, and > the latest version of fieldtrip (since I needed ft_get_opt as well), > but the spm8 images being written are still producing flawed > results. It's the same problem as I mentioned briefly in my previous > post. I am not getting any error messages when writing these images. > Rather, my problem is that the spm8 and spm2 results from the same > data ought to be identical when viewed in mricron, but they're far > from it. When I use mricron to look at the results from the spm8- > format images, combined across participants to create a t-image, I > just get a single 'blob' spanning roughly half the brain. In > contrast, when I used spm2-format previously on the same data, the t- > image was much more meaningful; a posterior alpha power decrease in > a set of regions corresponding to the 'task-positive network' (a > network found in the results of an fMRI version of my experiment, > and widely reported in the fMRI literature). > > This failure to replicate the spm2 results when using spm8 images > from the same data leads me to suspect that something is wrong with > the coordinates for spm8 format. However, after experimenting > extensively with different cfg options I still haven't identified > the problem. If I my structural MRIs have been saved to .mri files > using CTF's MRIConverter program, which cfg options, particularly > for coordinates, template images, and filetypes, should I specify > before calling the ft_volumesegment, ft_prepare_singleshell, > ft_sourceinterpolate, ft_volumenormalise, and ft_volumewrite > functions? Or should I be calling a different set of functions now? > > Thanks again for your help, > > Jen > > On Thu, Feb 24, 2011 at 10:07 AM, Jen Whitman > wrote: > Great, thanks! > > I'll start the analysis with your new script today and will let you > know how it works out. > > Jen > > On Thu, Feb 24, 2011 at 4:44 AM, jan-mathijs schoffelen > wrote: > Dear Jen, > > I managed to reproduce your problem. The code was rather buggy and > indeed ft_volumewrite did not behave as it should have. I now fixed > it in the code and it should run fine now. Please find the updated > file attached. It will be available on our ftp-server as of tonight. > Please note that I updated the documentation, and changed the names > of some of the options a bit. If you want to save your data in > analyze-format, you should specify cfg.filetype = 'analyze_spm'. If > you specify cfg.filetype = 'nifti', it should write out a volume to > nifti-format, using SPM8. > > Best wishes, > > Jan-Mathijs > > > > > > On Feb 23, 2011, at 7:44 PM, Jen Whitman wrote: > >> >> Dear Jan, >> >> Thanks for the quick reply. Yes, I have tried it out quite a few >> times now, experimenting with different settings in the cfgs. Below >> I'll paste the code I've been using to write images - first the >> code that successfully created spm2 images that produced good >> results, then the code used for creating nifti format images from >> the same data. The comments in this second part are at this point a >> bit of a maze of cfg options I've been changing back & forth. Any >> insights/suggestions regarding how to set up my cfgs to make this >> work would be greatly appreciated. >> >> Jen >> >> >> %%%%%%%% this code generated spm2-compatible images which did work >> (producing results that made sense). >> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% >> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% >> >> sourcetemp.avg.pow = (sourcetemp.avg.pow - >> sourcePre.avg.pow) ./ sourcePre.avg.pow; >> >> cfg = []; >> cfg.downsample = 2; >> sourcetempInt = sourceinterpolate(cfg, sourcetemp , mri); >> >> % projecting the plot onto a surface... >> cfg = []; >> cfg.coordinates = 'ctf'; >> cfg.template = '/home/common/matlab/spm2/templates/T1.mnc'; >> %this template is in MNI coordinates >> sourcetempIntN = volumenormalise(cfg, sourcetempInt); >> >> filename=[subj 'run' int2str(r) 'cond' int2str(cond) '_' >> int2str(f) 'HzWin' int2str(win) 'width750ms']; >> cfg=[]; >> cfg.parameter = 'avg.pow'; % string, describing the >> functional data to be processed, e.g. 'pow', 'coh' or 'nai' >> cfg.filename = [filename '.img']; >> %'testimageoutput_alphafreq'; % filename without the extension >> cfg.filetype = 'spm'; %'analyze', 'spm', 'vmp' or 'vmr' >> cfg.coordinates = 'spm'; %'spm, 'ctf' or empty for >> interactive (default = []) >> cfg.datatype = 'double'; %'float'; %'double'; %'bit1', 'uint8', >> 'int16', 'int32', 'float' or 'double' >> >> volumewrite(cfg, sourcetempIntN) >> >> >> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% >> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% >> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% >> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% >> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% >> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% >> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% >> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% >> %%%%% this code below hasn't worked yet... >> >> % I added cfg.spmversion = 'spm8'; >> % in the cfgs for the calls to ft_prepare_leadfield and >> ft_sourceanalysis, >> % and in the call to prepare_singleshell after calling volumesegment >> >> % I've also ensured that spm8 is the only spm version in my path, >> even in >> % the fieldtrip/external folder, and ensured that spm8 is installed >> properly >> % (files compiled correctly, etc..) >> >> sourcetemp.avg.pow = (sourcetemp.avg.pow - >> sourcePre.avg.pow) ./ sourcePre.avg.pow; >> >> filename=[subj 'run' int2str(r) 'cond' int2str(cond) '_' >> int2str(f) 'Hzspm8_FIXv9_Win' int2str(win) 'width750ms.img']; >> >> cfg = []; >> % cfg.coordinates = 'spm'; % changed for version 5 >> % cfg.spmversion = 'spm8'; % changed for version 5 >> cfg.downsample = 4; >> sourcetempInt = ft_sourceinterpolate(cfg, sourcetemp , mri); >> >> >> % projecting the plot onto a surface... >> cfg = []; >> %cfg.coordinates = 'spm'; % changed for version 5 >> %cfg.coordinates = 'ctf'; % changed for version 5 >> cfg.coordinates = 'spm'; % changed back to spm for version 9 >> cfg.downsample = 4; >> %cfg.spmversion = 'spm8'; % changed for version 6 (because this >> gets specified in volumewrite) >> cfg.template = 'Hmatrix/mask.nii.nii'; % basically equivalent >> to using spm8/templates/EPI.nii, except that mask.nii (produced >> from fmri data) has the desired voxel size >> % cfg.name = [filename]; % changed for version 6 >> %cfg.write= 'yes'; % changed for version 6 (when this was set >> to 'yes' there was no subsequent call to volumewrite) >> cfg.write= 'no'; % changed for version 6 >> sourcetempIntN = ft_volumenormalise(cfg, sourcetempInt); >> >> % this whole cfg and function call added for version 6 >> cfg=[]; >> % cfg.parameter = string, describing the functional data >> to be processed, e.g. 'pow', 'coh' or 'nai' >> % cfg.filename = filename without the extension >> % cfg.filetype = 'analyze', 'spm', 'vmp' or 'vmr' >> % cfg.vmpversion = 1 or 2 (default) version of the vmp-format >> to use >> % cfg.coordinates = 'spm, 'ctf' or empty for interactive >> (default = []) >> cfg.parameter='pow'; >> cfg.filename=filename; >> cfg.filetype = 'spm'; >> cfg.spmversion = 'SPM8'; % capitalized after first error >> message from vers 6 >> % cfg.dataformat='nifti'; % added after first error message from >> vers 6 >> % commented out after 2nd error >> message from vers 6 >> %cfg.vmpversion=2; % this is a filetype, like spm, so don't >> need to specify unless cfg.filetyp='vmp' >> cfg.coordinates='spm'; >> ft_volumewrite(cfg,sourcetempIntN); >> >> >> >> >> >> On Wed, Feb 23, 2011 at 7:50 AM, jan-mathijs schoffelen > > wrote: >> Dear Jen, >> >> I notice that indeed in the documentation section of >> ft_write_volume there is a FIXME behind nifti. Yet, nifti format >> seems to be supported by ft_write_volume (at least in a recent >> version of fieldtrip). Did you try it at all (and ran into >> problems) or were you held back by the FIXME statement? Could you >> just try it out using a recent fieldtrip function? >> >> Thanks and best wishes >> >> Jan-Mathijs >> >> >> >> On Feb 23, 2011, at 2:21 AM, Jen Whitman wrote: >> >> Hello, >> >> While writing beamformed images to spm2 format in a previous >> version of fieldtrip (now lost due to a computer crash), I was able >> to get nice-looking results; networks of brain regions consistent >> with existing literature. When I try to write images from the same >> dataset and the same analysis to spm8 format, my results (t-images >> computed across subjects) end up being single clusters spanning >> large sections of the brain (e.g. a 'blob' spanning all of one >> hemisphere but not the other). Unfortunately, some aspects of my >> planned data analyses cannot be performed on spm2 images, so I have >> to find a way of writing to successfully to nifti format. >> >> I just noticed that in the comments in the ft_write_volume >> function, which I am calling via ft_volumewrite, it says 'FIXME' >> next to nifti under the list of supported dataformats. Is there by >> any chance a patch out there for writing nifti images? >> >> Thanks! >> >> _______________________________________________ >> fieldtrip mailing list >> fieldtrip at donders.ru.nl >> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip >> >> Dr. J.M. (Jan-Mathijs) Schoffelen >> Donders Institute for Brain, Cognition and Behaviour, >> Centre for Cognitive Neuroimaging, >> Radboud University Nijmegen, The Netherlands >> J.Schoffelen at donders.ru.nl >> Telephone: 0031-24-3614793 >> >> _______________________________________________ >> fieldtrip mailing list >> fieldtrip at donders.ru.nl >> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip >> >> _______________________________________________ >> fieldtrip mailing list >> fieldtrip at donders.ru.nl >> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > > > Dr. J.M. (Jan-Mathijs) Schoffelen > Donders Institute for Brain, Cognition and Behaviour, > Centre for Cognitive Neuroimaging, > Radboud University Nijmegen, The Netherlands > J.Schoffelen at donders.ru.nl > Telephone: 0031-24-3614793 > > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > > Dr. J.M. (Jan-Mathijs) Schoffelen > Donders Institute for Brain, Cognition and Behaviour, > Centre for Cognitive Neuroimaging, > Radboud University Nijmegen, The Netherlands > J.Schoffelen at donders.ru.nl > Telephone: 0031-24-3614793 > > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > > Dr. J.M. (Jan-Mathijs) Schoffelen > Donders Institute for Brain, Cognition and Behaviour, > Centre for Cognitive Neuroimaging, > Radboud University Nijmegen, The Netherlands > J.Schoffelen at donders.ru.nl > Telephone: 0031-24-3614793 > > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 -------------- next part -------------- An HTML attachment was scrubbed... URL: From Jan.Hirschmann at med.uni-duesseldorf.de Tue Apr 12 13:08:55 2011 From: Jan.Hirschmann at med.uni-duesseldorf.de (Jan.Hirschmann at med.uni-duesseldorf.de) Date: Tue, 12 Apr 2011 13:08:55 +0200 Subject: [FieldTrip] I think you solved the problem In-Reply-To: <7B5CA863-D143-404C-BCB9-805AA6E6E546@donders.ru.nl> References: <72E993C35FB11743B79FF9286E5B6D8B02676142@Mail2-UKD.VMED.UKD> <7B5CA863-D143-404C-BCB9-805AA6E6E546@donders.ru.nl> Message-ID: <72E993C35FB11743B79FF9286E5B6D8B0267618F@Mail2-UKD.VMED.UKD> Dear JM, thanks a lot. I have actually just realized a few minutes ago that volumesegment and volumerealign are now supporting neuromag this way. It works just fine. I was already surprised that headcoordinates has a flag for neuromag now, and it should have occured to me that this means that also the higher-level functions were changed. Could I ask you to include this new feature in the help? I could also put an example script online if that is helpful for communicating this aspect (in case it hasn't been communicated long ago and I just missed it). Best, jan ________________________________ Von: fieldtrip-bounces at donders.ru.nl [mailto:fieldtrip-bounces at donders.ru.nl] Im Auftrag von jan-mathijs schoffelen Gesendet: Dienstag, 12. April 2011 12:11 An: Email discussion list for the FieldTrip project Betreff: Re: [FieldTrip] I think you solved the problem Dear Jan, Apart from not being properly aligned, the segmentation looks a bit strange to me. I suspect that not everything went well here ;o). Could you try the following: specify cfg.coordsys = 'neuromag', both in your call to ft_volumerealign and in your call to ft_volumesegment. The cfg.coordinates for ft_volumesegment has to be removed (actually it is a deprecated option). The idea now is that mri-structures in fieldtrip can have a coordsys field, which allows for more transparent use of the different head coordinate system conventions. This takes away the need for intermediately coregistering the MRI in 'ctf'-convention, and would also take away your need to call headcoordinates later on. Best wishes, Jan-Mathijs On Apr 12, 2011, at 11:07 AM, wrote: Dear fieldtrip experts, I have two questions regarding head model creation. As noted on this thread, the volumesegment function was updated and I tested it for our Neuromag data. The segmentation is performed, but unfortunately it is not aligned with the MRI in my case. Here is the code I am using, the fieldtrip is from 9th April 2011. %read mri mri = ft_read_mri(subject_files.fiff_mri); mri.anatomy=double(mri.anatomy); %these are the fiducials for this subject taken from the Neuromag GUI for coregistration cfg=[]; cfg.fiducial.rpa=[136.35 142.80 31.96]; cfg.fiducial.nas=[47.84 101.80 100.10]; cfg.fiducial.lpa=[139.22 146.17 162.69]; %define the head coordinate system according to CTF conventions cfg.method='fiducial'; real_mri=ft_volumerealign(cfg,mri); %segment cfg = []; cfg.template = '/data/apps/spm/spm8/templates/T1.nii'; cfg.coordinates = 'ctf'; cfg.keepintermediate = 'no'; segmentedmri = ft_volumesegment(cfg, real_mri); %plot white matter test=segmentedmri; test.anatomy=real_mri.anatomy; cfg=[]; cfg.funparameter='white'; ft_sourceplot(cfg,test); %see attached picture The other issue regards back-transformation from CTF to Neuromag coordinates, which is necessary to make the head model fit the sensors. My idea was to create an appropriate transformation matrix like this. cd /net/avidya/storage/home/jan/fieldtrip-20110409/private ctfmat=headcoordinates(nas,lpa,rpa,'ctf'); nmmat=headcoordinates(nas,lpa,rpa,'neuromag'); ctf_to_nm=nmmat/ctfmat; And then to use it on the head model to bring it back into Neuromag coordinates: %create single shell, realistic headmodel cfg = []; hdm = ft_prepare_singleshell(cfg,segmentedmri); % transformation of headmodel into Neuromag space hdm.bnd.pnt=warp_apply(ctf_to_nm,hdm.bnd.pnt,'homogeneous'); Does this survive a sanity check? Best regards and thanks a lot, Jan ________________________________ Von: fieldtrip-bounces at donders.ru.nl [mailto:fieldtrip-bounces at donders.ru.nl] Im Auftrag von Jen Whitman Gesendet: Montag, 28. Februar 2011 22:32 An: Email discussion list for the FieldTrip project Betreff: [FieldTrip] I think you solved the problem I just checked, and when I re-ran my segmentation script with the new Fieldtrip in order to use an spm8 template image, coordinates got reversed. When I take out the calls to flipdim, they look fine (see attached screenshots). That certainly explains the meaningless results I was getting! Thanks for figuring that out, Jen On Mon, Feb 28, 2011 at 12:36 PM, jan-mathijs schoffelen wrote: Hi Jen, At first glance I have a comment on your script. You may need to explicitly check the alignment of your segmented volume and the original anatomy. A while a go some changes were made to ft_volumesegment, taking away the need to do the flipdim(flipdim... operations. I have posted this on the discussion list last January, but you may not have noticed. Anyway, if you now have used a recent version of FieldTrip for your segmentation both the location of your dipole grid, and the volume conductor model will not be adequately coregistered with the data, which may lead to funky results to begin with. That's most likely not related to the filetype in which the volumes are saved for later use. Best wishes, Jan-Mathijs On Feb 28, 2011, at 8:59 PM, Jen Whitman wrote: Hello Jan, When calling volumesegment, I specified 'ctf' as the coordinate system. The function I wrote to call volumesegment and prepare_singleshell for each subject and save the results is pasted below, with a couple of comments added for clarity. Over the weekend I tried specifying the coordinate system in the call to ft_volumenormalise as 'ctf' rather than 'spm', and commented out all the lines that said cfg.spmversion = 'spm8'; before calling a function. However, that created worse results, as each plot involved stripes of activation and empty voxels, suggesting that 'ctf' was not the correct coordinate system to specify. Thanks for the attached script. Looking in that the comments in that, I suspect that the solution to my problems will be to specify my filetype as nifti_img rather than nifti. I'll let you know how that goes. Jen ------------------------------------------------------------------------ ------------------------------------ % the variable subj is simply a string consisting of a subject number (e.g. 's05') which can be a folder name or part of a filename function [vol mri segmentedmri segmentedmriF]=call_volume_segment_function_spm8(subj) cfg.spmversion = 'spm8'; cfg.template = '/home/woodwardlab/spm8/templates/EPI.nii'; %cfg.template='/home/common/matlab/spm2/templates/T1.mnc'; cfg.name=[subj '_volseg']; cfg.write='yes'; cfg.smooth='no'; cfg.coordinates='ctf'; mri=read_mri([subj '/mri/' subj 'head.mri']); % made with CTF mriConverter and mriViewer software, after fiducials were marked segmentedmri = volumesegment(cfg, mri); segmentedmriF = segmentedmri; segmentedmriF.gray = flipdim(flipdim(flipdim(segmentedmriF.gray,3),2),1); segmentedmriF.white = flipdim(flipdim(flipdim(segmentedmriF.white,3),2),1); segmentedmriF.csf = flipdim(flipdim(flipdim(segmentedmriF.csf,3),2),1); segmentedmriF.transform = mri.transform; segmentedmriF.anatomy = mri.anatomy; cfg = []; cfg.spmversion = 'spm8'; vol = prepare_singleshell(cfg, segmentedmriF); eval(['save ' subj '/meg/mrisegmented.mat mri segmentedmri segmentedmriF vol']) On Sat, Feb 26, 2011 at 5:26 AM, jan-mathijs schoffelen wrote: Dear Jen, I do not manage to reproduce your issue, when only focussing on the ft_volumewrite and visualization part of your pipeline. See attached script, and yet an updated version of ft_volumewrite which you need to (hopefully) draw the same conclusion as I did. Yet, I only now realize that your question may pertain to the entire pipeline. It could be that something is going wrong there. I only see now that in the part of your script of which you reported that it gave 'good' results, you specify cfg.coordinates = 'ctf' before calling ft_volumenormalise. I assume this is correct, because the coordinate system your source-reconstructed data lives in, is according to the CTF-convention, and not according to the SPM-convention. On the other hand, the template for the spatial normalization lives in the SPM-coordinate system. In order for the spatial normalization to work OK, Fieldtrip tries to convert from one coordinate system to the other (once again, this is appropriate behaviour), before doing the actual normalization. It seems that at least in the script you sent along, in the final (not working version), you specified cfg.coordinates = 'spm' prior to calling ft_volumenormalise. This is probably wrong. Another important point that should be mentioned, is that the coordinate systems in which the functional data and the anatomical data live should be the same for the ft_sourceinterpolate to make sense. In other words, if your source reconstructed images are defined on a 3D grid of positions in CTF-space, the mri.transform of your anatomy should describe a transformation from voxel to CTF-space. I think you may want to revisit step by step this part of the pipeline; I don't think the problem lies in the writing. A final possibility of course is that Mricron is misbehaving... Best, Jan-Mathijs On Feb 25, 2011, at 9:44 PM, Jen Whitman wrote: Hi Jan, I tried re-running the analysis with the new script you sent me, and the latest version of fieldtrip (since I needed ft_get_opt as well), but the spm8 images being written are still producing flawed results. It's the same problem as I mentioned briefly in my previous post. I am not getting any error messages when writing these images. Rather, my problem is that the spm8 and spm2 results from the same data ought to be identical when viewed in mricron, but they're far from it. When I use mricron to look at the results from the spm8-format images, combined across participants to create a t-image, I just get a single 'blob' spanning roughly half the brain. In contrast, when I used spm2-format previously on the same data, the t-image was much more meaningful; a posterior alpha power decrease in a set of regions corresponding to the 'task-positive network' (a network found in the results of an fMRI version of my experiment, and widely reported in the fMRI literature). This failure to replicate the spm2 results when using spm8 images from the same data leads me to suspect that something is wrong with the coordinates for spm8 format. However, after experimenting extensively with different cfg options I still haven't identified the problem. If I my structural MRIs have been saved to .mri files using CTF's MRIConverter program, which cfg options, particularly for coordinates, template images, and filetypes, should I specify before calling the ft_volumesegment, ft_prepare_singleshell, ft_sourceinterpolate, ft_volumenormalise, and ft_volumewrite functions? Or should I be calling a different set of functions now? Thanks again for your help, Jen On Thu, Feb 24, 2011 at 10:07 AM, Jen Whitman wrote: Great, thanks! I'll start the analysis with your new script today and will let you know how it works out. Jen On Thu, Feb 24, 2011 at 4:44 AM, jan-mathijs schoffelen wrote: Dear Jen, I managed to reproduce your problem. The code was rather buggy and indeed ft_volumewrite did not behave as it should have. I now fixed it in the code and it should run fine now. Please find the updated file attached. It will be available on our ftp-server as of tonight. Please note that I updated the documentation, and changed the names of some of the options a bit. If you want to save your data in analyze-format, you should specify cfg.filetype = 'analyze_spm'. If you specify cfg.filetype = 'nifti', it should write out a volume to nifti-format, using SPM8. Best wishes, Jan-Mathijs On Feb 23, 2011, at 7:44 PM, Jen Whitman wrote: Dear Jan, Thanks for the quick reply. Yes, I have tried it out quite a few times now, experimenting with different settings in the cfgs. Below I'll paste the code I've been using to write images - first the code that successfully created spm2 images that produced good results, then the code used for creating nifti format images from the same data. The comments in this second part are at this point a bit of a maze of cfg options I've been changing back & forth. Any insights/suggestions regarding how to set up my cfgs to make this work would be greatly appreciated. Jen %%%%%%%% this code generated spm2-compatible images which did work (producing results that made sense). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% sourcetemp.avg.pow = (sourcetemp.avg.pow - sourcePre.avg.pow) ./ sourcePre.avg.pow; cfg = []; cfg.downsample = 2; sourcetempInt = sourceinterpolate(cfg, sourcetemp , mri); % projecting the plot onto a surface... cfg = []; cfg.coordinates = 'ctf'; cfg.template = '/home/common/matlab/spm2/templates/T1.mnc'; %this template is in MNI coordinates sourcetempIntN = volumenormalise(cfg, sourcetempInt); filename=[subj 'run' int2str(r) 'cond' int2str(cond) '_' int2str(f) 'HzWin' int2str(win) 'width750ms']; cfg=[]; cfg.parameter = 'avg.pow'; % string, describing the functional data to be processed, e.g. 'pow', 'coh' or 'nai' cfg.filename = [filename '.img']; %'testimageoutput_alphafreq'; % filename without the extension cfg.filetype = 'spm'; %'analyze', 'spm', 'vmp' or 'vmr' cfg.coordinates = 'spm'; %'spm, 'ctf' or empty for interactive (default = []) cfg.datatype = 'double'; %'float'; %'double'; %'bit1', 'uint8', 'int16', 'int32', 'float' or 'double' volumewrite(cfg, sourcetempIntN) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%% this code below hasn't worked yet... % I added cfg.spmversion = 'spm8'; % in the cfgs for the calls to ft_prepare_leadfield and ft_sourceanalysis, % and in the call to prepare_singleshell after calling volumesegment % I've also ensured that spm8 is the only spm version in my path, even in % the fieldtrip/external folder, and ensured that spm8 is installed properly % (files compiled correctly, etc..) sourcetemp.avg.pow = (sourcetemp.avg.pow - sourcePre.avg.pow) ./ sourcePre.avg.pow; filename=[subj 'run' int2str(r) 'cond' int2str(cond) '_' int2str(f) 'Hzspm8_FIXv9_Win' int2str(win) 'width750ms.img']; cfg = []; % cfg.coordinates = 'spm'; % changed for version 5 % cfg.spmversion = 'spm8'; % changed for version 5 cfg.downsample = 4; sourcetempInt = ft_sourceinterpolate(cfg, sourcetemp , mri); % projecting the plot onto a surface... cfg = []; %cfg.coordinates = 'spm'; % changed for version 5 %cfg.coordinates = 'ctf'; % changed for version 5 cfg.coordinates = 'spm'; % changed back to spm for version 9 cfg.downsample = 4; %cfg.spmversion = 'spm8'; % changed for version 6 (because this gets specified in volumewrite) cfg.template = 'Hmatrix/mask.nii.nii'; % basically equivalent to using spm8/templates/EPI.nii, except that mask.nii (produced from fmri data) has the desired voxel size % cfg.name = [filename]; % changed for version 6 %cfg.write= 'yes'; % changed for version 6 (when this was set to 'yes' there was no subsequent call to volumewrite) cfg.write= 'no'; % changed for version 6 sourcetempIntN = ft_volumenormalise(cfg, sourcetempInt); % this whole cfg and function call added for version 6 cfg=[]; % cfg.parameter = string, describing the functional data to be processed, e.g. 'pow', 'coh' or 'nai' % cfg.filename = filename without the extension % cfg.filetype = 'analyze', 'spm', 'vmp' or 'vmr' % cfg.vmpversion = 1 or 2 (default) version of the vmp-format to use % cfg.coordinates = 'spm, 'ctf' or empty for interactive (default = []) cfg.parameter='pow'; cfg.filename=filename; cfg.filetype = 'spm'; cfg.spmversion = 'SPM8'; % capitalized after first error message from vers 6 % cfg.dataformat='nifti'; % added after first error message from vers 6 % commented out after 2nd error message from vers 6 %cfg.vmpversion=2; % this is a filetype, like spm, so don't need to specify unless cfg.filetyp='vmp' cfg.coordinates='spm'; ft_volumewrite(cfg,sourcetempIntN); On Wed, Feb 23, 2011 at 7:50 AM, jan-mathijs schoffelen wrote: Dear Jen, I notice that indeed in the documentation section of ft_write_volume there is a FIXME behind nifti. Yet, nifti format seems to be supported by ft_write_volume (at least in a recent version of fieldtrip). Did you try it at all (and ran into problems) or were you held back by the FIXME statement? Could you just try it out using a recent fieldtrip function? Thanks and best wishes Jan-Mathijs On Feb 23, 2011, at 2:21 AM, Jen Whitman wrote: Hello, While writing beamformed images to spm2 format in a previous version of fieldtrip (now lost due to a computer crash), I was able to get nice-looking results; networks of brain regions consistent with existing literature. When I try to write images from the same dataset and the same analysis to spm8 format, my results (t-images computed across subjects) end up being single clusters spanning large sections of the brain (e.g. a 'blob' spanning all of one hemisphere but not the other). Unfortunately, some aspects of my planned data analyses cannot be performed on spm2 images, so I have to find a way of writing to successfully to nifti format. I just noticed that in the comments in the ft_write_volume function, which I am calling via ft_volumewrite, it says 'FIXME' next to nifti under the list of supported dataformats. Is there by any chance a patch out there for writing nifti images? Thanks! _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 -------------- next part -------------- An HTML attachment was scrubbed... URL: From lieneke.janssen at student.ru.nl Tue Apr 12 14:59:46 2011 From: lieneke.janssen at student.ru.nl (Lieneke. Janssen) Date: Tue, 12 Apr 2011 14:59:46 +0200 (CEST) Subject: [FieldTrip] ft_timelockanalysis, trial selection In-Reply-To: <1126858119.313915.1302612752580.JavaMail.root@monoceros.zimbra.ru.nl> Message-ID: <812169884.314034.1302613186099.JavaMail.root@monoceros.zimbra.ru.nl> Dear fieldtrippers, Previously, I could do time-locked analysis on select trials only. Today however, I get an error (same script and similar data) which you can see below. After quite some debugging attempts, going into the other functions involved and googling a bit I think I found a little bug in the private function [data] = selfromraw(data, varargin{:}) that is called by ft_selectdata. In this private function keyval(key,varargin{:}) is not yet changed into keyval(key,varargin). See log messeage at http://code.google.com/p/fieldtrip/source/detail?spec=svn3292&r=3292. If you run keyval(key,varargin{:}) on the command line you get the error, if you run keyval(key,varargin) on the command line you don't. Hopefully, somebody can help me with this :). Thanks! Best, Lieneke --------------------------------------------------------------- ??? Error using ==> keyval the first input argument should be a cell-array or structure Error in ==> selfromraw at 3 selrpt = keyval('rpt', varargin{:}); selectrpt = ~isempty(strmatch(varargin(cellfun(@ischar, varargin)), 'rpt')); Error in ==> ft_selectdata at 508 data = selfromraw(data, 'rpt', selrpt); Error in ==> ft_timelockanalysis at 148 data = ft_selectdata(data, 'rpt', cfg.trials); Error in ==> lj_main_rfm at 255 timelock_out = ft_timelockanalysis(cfg, resampled_data); From jan.schoffelen at donders.ru.nl Tue Apr 12 15:29:44 2011 From: jan.schoffelen at donders.ru.nl (jan-mathijs schoffelen) Date: Tue, 12 Apr 2011 15:29:44 +0200 Subject: [FieldTrip] ft_timelockanalysis, trial selection In-Reply-To: <812169884.314034.1302613186099.JavaMail.root@monoceros.zimbra.ru.nl> References: <812169884.314034.1302613186099.JavaMail.root@monoceros.zimbra.ru.nl> Message-ID: <3CF7EDEF-9024-48EC-94EA-56380E5FBD44@donders.ru.nl> Dear Lieneke, Thanks for your detailed report on this bug, and sorry for the inconvenience. I fixed it now, and it should become available to you (at /home/common/matlab/fieldtrip) within the coming 15 minutes or so. If you are using an external version, it will become available on the ftp-server tonight. Best wishes, Jan-Mathijs On Apr 12, 2011, at 2:59 PM, Lieneke. Janssen wrote: > Dear fieldtrippers, > > Previously, I could do time-locked analysis on select trials only. > Today however, I get an error (same script and similar data) which > you can see below. > > After quite some debugging attempts, going into the other functions > involved and googling a bit I think I found a little bug in the > private function [data] = selfromraw(data, varargin{:}) that is > called by ft_selectdata. > > In this private function keyval(key,varargin{:}) is not yet changed > into keyval(key,varargin). See log messeage at http://code.google.com/p/fieldtrip/source/detail?spec=svn3292&r=3292 > . > > If you run keyval(key,varargin{:}) on the command line you get the > error, if you run keyval(key,varargin) on the command line you don't. > > Hopefully, somebody can help me with this :). > Thanks! > > Best, > Lieneke > > > > > > > > > --------------------------------------------------------------- > ??? Error using ==> keyval > the first input argument should be a cell-array or structure > > Error in ==> selfromraw at 3 > selrpt = keyval('rpt', varargin{:}); selectrpt = > ~isempty(strmatch(varargin(cellfun(@ischar, varargin)), 'rpt')); > > Error in ==> ft_selectdata at 508 > data = selfromraw(data, 'rpt', selrpt); > > Error in ==> ft_timelockanalysis at 148 > data = ft_selectdata(data, 'rpt', cfg.trials); > > Error in ==> lj_main_rfm at 255 > timelock_out = ft_timelockanalysis(cfg, resampled_data); > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 From jan.schoffelen at donders.ru.nl Tue Apr 12 15:38:24 2011 From: jan.schoffelen at donders.ru.nl (jan-mathijs schoffelen) Date: Tue, 12 Apr 2011 15:38:24 +0200 Subject: [FieldTrip] Fwd: ft_selectdata References: Message-ID: <9ED1C053-FFB7-4795-9AD0-BED55E003E3D@donders.ru.nl> Dear Mark, I forward your message to the list in order for other people to also benefit from it (regarding your question: at least those who can read Dutch: ;o) ). Your question relates to an error you get, when calling ft_selectdata using a variable 'Data', which I assume to be the output of ft_timelockgrandaverage. Moreover, I assume you are using a not up-to-date version of FieldTrip, because your variable 'Data' contains both and .avg-field, and in .individual-field. This makes the data-object ambiguous with respect to the 'dimord'; for the .individual-field the 'dimord' should be 'subj_chan_time', and for the .avg-field the 'dimord' should be 'chan_time'. This is why we recently changed ft_timelockgrandaverage to only output the .individual-field, if cfg.keepindividual = 'yes'; Moreover, we recently fixed a small bug related to ft_selectdata not being able to correctly deal with the 'dimord'-string 'subj'. In other words, could you please update to a recent version of FieldTrip and try again? Best wishes, Jan-Mathijs Begin forwarded message: > From: Mark Noordenbos > Date: April 12, 2011 10:37:05 AM GMT+02:00 > To: j.schoffelen at donders.ru.nl > Subject: !!!!!SPAM!!!!! ft_selectdata > > Beste Jan-Mathijs, > > Momenteel gebruik ik Fieldtrip voor het analyseren van timelocked > EEG data. Nu wil ik op basis van cluster analyse kijken of er een > verschil tussen de linker en rechter hemisfeer, maar volgens mij zit > deze optie helaas alleen in ft_sourcestatistics. Daarom probeer ik > met ft_selectdata de data te selecteren voor de linker en rechter > hemisfeer op basis van channels. Daarna heb ik de labels in de ene > dataset aangepast omdat er anders geen channels worden gevonden die > overeenkomen. > > chan_left = {'F7','F3', 'FC5','FC1','T7','C3','CP1','P7','P3','O1'}; > chan_right = {'F8','F4', 'FC6','FC2','T8','C4','CP2','P8','P4','O2'}; > Data_left = ft_selectdata(Data, 'channel', chan_left); > Data_right = ft_selectdata(Data, 'channel', chan_right); > Data_right.label= {'F3','F7','FC1','FC5','C3','CP1','P3','P7','O2'}; > > Maar met ft_selectdata krijg ik steeds de volgende foutmelding: > > ??? Attempted to access n(1); index out of bounds because numel(n)=0. > > Error in ==> dimlength at 115 > if ~all(n==n(1)) > > Error in ==> dimlength at 46 > n{k}(i) = dimlength(data, dimtok{i}, fn{k}); > > Error in ==> seloverdim at 39 > [reduceddim, fntmp] = dimlength(data); > > Error in ==> ft_selectdata at 562 > if selectrpt, data = seloverdim(data, 'rpt', selrpt, fb); end > > > Kan het kloppen dat ft_selectdata niet overweg kan met > Data.individuals want als ik dit verwijder en Data.dimord verander > in chan_time dan werkt ft_selectdata wel. > > Data bestaat uit: > > label: {30x1 cell} > fsample: 500 > avg: [30x350 double] > var: [30x350 double] > time: [1x350 double] > individual: [31x30x350 double] > dimord: 'subj_chan_time' > cfg: [1x1 struct] > > > > Wellicht doe ik iets verkeerd of is er misschien een andere (betere) > methode voor het vergelijken van hemisferen voor timelocked EEG data. > > Alvast bedankt, > Mark Noordenbos > > -- > Mark Noordenbos, MSc > > Radboud University Nijmegen > Behavioural Science Institute > > P.O. Box 9104, Room A05.36 > 6500 HE Nijmegen > The Netherlands > > Email: m.noordenbos at bsi.ru.nl > Telephone: +31 24 3612070 > Fax: +31 24 3616211 > > http://www.ru.nl Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 -------------- next part -------------- An HTML attachment was scrubbed... URL: From lieneke.janssen at student.ru.nl Tue Apr 12 16:34:32 2011 From: lieneke.janssen at student.ru.nl (Lieneke. Janssen) Date: Tue, 12 Apr 2011 16:34:32 +0200 (CEST) Subject: [FieldTrip] ft_timelockanalysis, trial selection In-Reply-To: <3CF7EDEF-9024-48EC-94EA-56380E5FBD44@donders.ru.nl> Message-ID: <1222293418.316034.1302618872718.JavaMail.root@monoceros.zimbra.ru.nl> Perfect, thanks! Tot zover m'n omslachtige trial selectie. Groetjes, Lieneke ----- "jan-mathijs schoffelen" wrote: > From: "jan-mathijs schoffelen" > To: "Email discussion list for the FieldTrip project" > Sent: Tuesday, April 12, 2011 3:29:44 PM > Subject: Re: [FieldTrip] ft_timelockanalysis, trial selection > > Dear Lieneke, > > Thanks for your detailed report on this bug, and sorry for the > inconvenience. I fixed it now, and it should become available to you > > (at /home/common/matlab/fieldtrip) within the coming 15 minutes or so. > > If you are using an external version, it will become available on the > > ftp-server tonight. > > Best wishes, > > Jan-Mathijs > > > > On Apr 12, 2011, at 2:59 PM, Lieneke. Janssen wrote: > > > Dear fieldtrippers, > > > > Previously, I could do time-locked analysis on select trials only. > > > Today however, I get an error (same script and similar data) which > > > you can see below. > > > > After quite some debugging attempts, going into the other functions > > > involved and googling a bit I think I found a little bug in the > > private function [data] = selfromraw(data, varargin{:}) that is > > called by ft_selectdata. > > > > In this private function keyval(key,varargin{:}) is not yet changed > > > into keyval(key,varargin). See log messeage at > http://code.google.com/p/fieldtrip/source/detail?spec=svn3292&r=3292 > > . > > > > If you run keyval(key,varargin{:}) on the command line you get the > > > error, if you run keyval(key,varargin) on the command line you > don't. > > > > Hopefully, somebody can help me with this :). > > Thanks! > > > > Best, > > Lieneke > > > > > > > > > > > > > > > > > > --------------------------------------------------------------- > > ??? Error using ==> keyval > > the first input argument should be a cell-array or structure > > > > Error in ==> selfromraw at 3 > > selrpt = keyval('rpt', varargin{:}); selectrpt = > > ~isempty(strmatch(varargin(cellfun(@ischar, varargin)), 'rpt')); > > > > Error in ==> ft_selectdata at 508 > > data = selfromraw(data, 'rpt', selrpt); > > > > Error in ==> ft_timelockanalysis at 148 > > data = ft_selectdata(data, 'rpt', cfg.trials); > > > > Error in ==> lj_main_rfm at 255 > > timelock_out = ft_timelockanalysis(cfg, resampled_data); > > _______________________________________________ > > fieldtrip mailing list > > fieldtrip at donders.ru.nl > > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > > Dr. J.M. (Jan-Mathijs) Schoffelen > Donders Institute for Brain, Cognition and Behaviour, > Centre for Cognitive Neuroimaging, > Radboud University Nijmegen, The Netherlands > J.Schoffelen at donders.ru.nl > Telephone: 0031-24-3614793 > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip From sherrykhan78 at gmail.com Tue Apr 12 20:06:32 2011 From: sherrykhan78 at gmail.com (Sheraz Khan) Date: Tue, 12 Apr 2011 14:06:32 -0400 Subject: [FieldTrip] Postdoctoral Fellowship: Multimodal Neuroimaging -MGH/Harvard Medical School Message-ID: Postdoctoral Fellowship: Multimodal Neuroimaging -MGH/Harvard Medical School Job Description A postdoctoral position is available with the TRANSCEND Research Program ( www.transcendresearch.org) at the Martinos Center for Biomedical Imaging in Charlestown, MA (www.martinos.org) which is affiliated with the Massachusetts General Hospital, Harvard Medical School and MIT. We are seeking a candidate with a strong basis in magnetic resonance imaging. Emphasis will be on MRI (DTI, spectroscopy, morphometry, ASL as well as resting state fMRI), and on co-registering MEG with MRI. This position will involve analysis of existing multimodal imaging data and collection of new data. The emphasis of the postdoctoral fellowship will be analysis of existing datasets with secondary activity in piloting data for new studies. It will involve working closely with a multidisciplinary team and with children, and will also involve some research oriented analysis of data collected for clinical purposes. After initial phase-in, ample opportunity will also be provided to the candidate to self-explore and lead research. Datasets to be analyzed include: MRI (including DTI and 1H-spectroscopy) and MEG data on 6-12 and teenage matched autism spectrum and control subjects with phenotyping data MRI data ( (morphometry, DTI, spectroscopy) plus laboratory and phenotyping data) on 70 children with autism plus epilepsy and/or mitochondrial dysfunction, along with one or more overnight EEGs on each patient data from children ages 2-10 with and without autism. Overall objectives: To perform multimodal analyses of research and clinical research data, to develop new approaches for performing these analyses, and to design pipelines for data analysis. To write papers and grants which will be high priorities all along the way and will be actively supported by senior faculty. To take advantage of the world class faculty and facilities of the Martinos Center for Biomedical Imaging to perform the above activities to their maximal potential. The program’s emphasis is on pathophysiologically grounded brain research and application of advanced imaging acquisition and analysis techniques to neurological and sensory aspects of autism spectrum disorders. Requirements: Candidates must have PhD in neuroscience, physics, biomedical engineering, electrical engineering, computer science or other related fields. Prior experience in MRI analysis is required. Experience with EEG will be an added advantage. Salary will be consistent with Massachusetts General Hospital, Harvard Medical School policies for Postdoctoral trainees and will range between $45,000 to $55,000 depending upon qualifications and experience. Compensation also includes full staff benefits, including health insurance, and vacation time. Contact: Interested applicants may send a CV and statement of interest addressing background and specific pertinence of the candidate’s interest to Dr. Martha R. Herbert at mherbert1 at partners.org and cc transcend at partners.org. Applications will be considered until the position is filled. -------------- next part -------------- An HTML attachment was scrubbed... URL: From Jan.Hirschmann at med.uni-duesseldorf.de Tue Apr 12 20:49:10 2011 From: Jan.Hirschmann at med.uni-duesseldorf.de (Jan.Hirschmann at med.uni-duesseldorf.de) Date: Tue, 12 Apr 2011 20:49:10 +0200 Subject: [FieldTrip] I think you solved the problem In-Reply-To: <7B5CA863-D143-404C-BCB9-805AA6E6E546@donders.ru.nl> References: <72E993C35FB11743B79FF9286E5B6D8B02676142@Mail2-UKD.VMED.UKD> <7B5CA863-D143-404C-BCB9-805AA6E6E546@donders.ru.nl> Message-ID: <72E993C35FB11743B79FF9286E5B6D8B02676264@Mail2-UKD.VMED.UKD> Dear Jan-Mathijs, sorry, I think I was a bit too enthusiastic when I said everything worked out wonderfully. It worked only once. After an afternoon of confusion I concluded that on my first try I must have misspelled cfg.coordsys='neuromag' on my calls to ft_volumerealign and ft_volumesegment. In fact, the segmentation looks really bad with these settings. What works for me is written underneath: mri = ft_read_mri('....fif'); hdr=ft_read_header('...fif'); mri.anatomy=double(mri.anatomy); %this is taken from the Neuromag GUI for MRI-MEG Integration cfg=[]; cfg.fiducial.rpa=[136.35 142.80 31.96]; cfg.fiducial.nas=[47.84 101.80 100.10]; cfg.fiducial.lpa=[139.22 146.17 162.69]; %go from neuromag voxel to neuromag head coordinates cfg.coordsys='neuromag'; cfg.method='fiducial'; real_mri=ft_volumerealign(cfg,mri); %taking real_mri with its coordsys field will not work, so I take mri mri.transform=real_mri.transform; cfg = []; cfg.keepintermediate = 'no'; cfg.write = 'no'; segmentedmri = ft_volumesegment(cfg, mri); Before segmentation the function shows some kind of brain (pic 1). When segmentation is done the segmented brain looks good (pic 2) but the brain does not fit the helmet (pic 3). It is looking at its feet as if it dropped some pocket change. Do you know what is going on? Thanks, jan ________________________________ Von: fieldtrip-bounces at donders.ru.nl [mailto:fieldtrip-bounces at donders.ru.nl] Im Auftrag von jan-mathijs schoffelen Gesendet: Dienstag, 12. April 2011 12:11 An: Email discussion list for the FieldTrip project Betreff: Re: [FieldTrip] I think you solved the problem Dear Jan, Apart from not being properly aligned, the segmentation looks a bit strange to me. I suspect that not everything went well here ;o). Could you try the following: specify cfg.coordsys = 'neuromag', both in your call to ft_volumerealign and in your call to ft_volumesegment. The cfg.coordinates for ft_volumesegment has to be removed (actually it is a deprecated option). The idea now is that mri-structures in fieldtrip can have a coordsys field, which allows for more transparent use of the different head coordinate system conventions. This takes away the need for intermediately coregistering the MRI in 'ctf'-convention, and would also take away your need to call headcoordinates later on. Best wishes, Jan-Mathijs On Apr 12, 2011, at 11:07 AM, < Jan.Hirschmann at med.uni-duesseldorf.de> wrote: Dear fieldtrip experts, I have two questions regarding head model creation. As noted on this thread, the volumesegment function was updated and I tested it for our Neuromag data. The segmentation is performed, but unfortunately it is not aligned with the MRI in my case. Here is the code I am using, the fieldtrip is from 9th April 2011. %read mri mri = ft_read_mri(subject_files.fiff_mri); mri.anatomy=double(mri.anatomy); %these are the fiducials for this subject taken from the Neuromag GUI for coregistration cfg=[]; cfg.fiducial.rpa=[136.35 142.80 31.96]; cfg.fiducial.nas=[47.84 101.80 100.10]; cfg.fiducial.lpa=[139.22 146.17 162.69]; %define the head coordinate system according to CTF conventions cfg.method='fiducial'; real_mri=ft_volumerealign(cfg,mri); %segment cfg = []; cfg.template = '/data/apps/spm/spm8/templates/T1.nii'; cfg.coordinates = 'ctf'; cfg.keepintermediate = 'no'; segmentedmri = ft_volumesegment(cfg, real_mri); %plot white matter test=segmentedmri; test.anatomy=real_mri.anatomy; cfg=[]; cfg.funparameter='white'; ft_sourceplot(cfg,test); %see attached picture The other issue regards back-transformation from CTF to Neuromag coordinates, which is necessary to make the head model fit the sensors. My idea was to create an appropriate transformation matrix like this. cd /net/avidya/storage/home/jan/fieldtrip-20110409/private ctfmat=headcoordinates(nas,lpa,rpa,'ctf'); nmmat=headcoordinates(nas,lpa,rpa,'neuromag'); ctf_to_nm=nmmat/ctfmat; And then to use it on the head model to bring it back into Neuromag coordinates: %create single shell, realistic headmodel cfg = []; hdm = ft_prepare_singleshell(cfg,segmentedmri); % transformation of headmodel into Neuromag space hdm.bnd.pnt=warp_apply(ctf_to_nm,hdm.bnd.pnt,'homogeneous'); Does this survive a sanity check? Best regards and thanks a lot, Jan ________________________________ Von: fieldtrip-bounces at donders.ru.nl [ mailto:fieldtrip-bounces at donders.ru.nl] Im Auftrag von Jen Whitman Gesendet: Montag, 28. Februar 2011 22:32 An: Email discussion list for the FieldTrip project Betreff: [FieldTrip] I think you solved the problem I just checked, and when I re-ran my segmentation script with the new Fieldtrip in order to use an spm8 template image, coordinates got reversed. When I take out the calls to flipdim, they look fine (see attached screenshots). That certainly explains the meaningless results I was getting! Thanks for figuring that out, Jen On Mon, Feb 28, 2011 at 12:36 PM, jan-mathijs schoffelen < jan.schoffelen at donders.ru.nl> wrote: Hi Jen, At first glance I have a comment on your script. You may need to explicitly check the alignment of your segmented volume and the original anatomy. A while a go some changes were made to ft_volumesegment, taking away the need to do the flipdim(flipdim... operations. I have posted this on the discussion list last January, but you may not have noticed. Anyway, if you now have used a recent version of FieldTrip for your segmentation both the location of your dipole grid, and the volume conductor model will not be adequately coregistered with the data, which may lead to funky results to begin with. That's most likely not related to the filetype in which the volumes are saved for later use. Best wishes, Jan-Mathijs On Feb 28, 2011, at 8:59 PM, Jen Whitman wrote: Hello Jan, When calling volumesegment, I specified 'ctf' as the coordinate system. The function I wrote to call volumesegment and prepare_singleshell for each subject and save the results is pasted below, with a couple of comments added for clarity. Over the weekend I tried specifying the coordinate system in the call to ft_volumenormalise as 'ctf' rather than 'spm', and commented out all the lines that said cfg.spmversion = 'spm8'; before calling a function. However, that created worse results, as each plot involved stripes of activation and empty voxels, suggesting that 'ctf' was not the correct coordinate system to specify. Thanks for the attached script. Looking in that the comments in that, I suspect that the solution to my problems will be to specify my filetype as nifti_img rather than nifti. I'll let you know how that goes. Jen ------------------------------------------------------------------------ ------------------------------------ % the variable subj is simply a string consisting of a subject number (e.g. 's05') which can be a folder name or part of a filename function [vol mri segmentedmri segmentedmriF]=call_volume_segment_function_spm8(subj) cfg.spmversion = 'spm8'; cfg.template = '/home/woodwardlab/spm8/templates/EPI.nii'; %cfg.template='/home/common/matlab/spm2/templates/T1.mnc'; cfg.name=[subj '_volseg']; cfg.write='yes'; cfg.smooth='no'; cfg.coordinates='ctf'; mri=read_mri([subj '/mri/' subj 'head.mri']); % made with CTF mriConverter and mriViewer software, after fiducials were marked segmentedmri = volumesegment(cfg, mri); segmentedmriF = segmentedmri; segmentedmriF.gray = flipdim(flipdim(flipdim(segmentedmriF.gray,3),2),1); segmentedmriF.white = flipdim(flipdim(flipdim(segmentedmriF.white,3),2),1); segmentedmriF.csf = flipdim(flipdim(flipdim(segmentedmriF.csf,3),2),1); segmentedmriF.transform = mri.transform; segmentedmriF.anatomy = mri.anatomy; cfg = []; cfg.spmversion = 'spm8'; vol = prepare_singleshell(cfg, segmentedmriF); eval(['save ' subj '/meg/mrisegmented.mat mri segmentedmri segmentedmriF vol']) On Sat, Feb 26, 2011 at 5:26 AM, jan-mathijs schoffelen < jan.schoffelen at donders.ru.nl> wrote: Dear Jen, I do not manage to reproduce your issue, when only focussing on the ft_volumewrite and visualization part of your pipeline. See attached script, and yet an updated version of ft_volumewrite which you need to (hopefully) draw the same conclusion as I did. Yet, I only now realize that your question may pertain to the entire pipeline. It could be that something is going wrong there. I only see now that in the part of your script of which you reported that it gave 'good' results, you specify cfg.coordinates = 'ctf' before calling ft_volumenormalise. I assume this is correct, because the coordinate system your source-reconstructed data lives in, is according to the CTF-convention, and not according to the SPM-convention. On the other hand, the template for the spatial normalization lives in the SPM-coordinate system. In order for the spatial normalization to work OK, Fieldtrip tries to convert from one coordinate system to the other (once again, this is appropriate behaviour), before doing the actual normalization. It seems that at least in the script you sent along, in the final (not working version), you specified cfg.coordinates = 'spm' prior to calling ft_volumenormalise. This is probably wrong. Another important point that should be mentioned, is that the coordinate systems in which the functional data and the anatomical data live should be the same for the ft_sourceinterpolate to make sense. In other words, if your source reconstructed images are defined on a 3D grid of positions in CTF-space, the mri.transform of your anatomy should describe a transformation from voxel to CTF-space. I think you may want to revisit step by step this part of the pipeline; I don't think the problem lies in the writing. A final possibility of course is that Mricron is misbehaving... Best, Jan-Mathijs On Feb 25, 2011, at 9:44 PM, Jen Whitman wrote: Hi Jan, I tried re-running the analysis with the new script you sent me, and the latest version of fieldtrip (since I needed ft_get_opt as well), but the spm8 images being written are still producing flawed results. It's the same problem as I mentioned briefly in my previous post. I am not getting any error messages when writing these images. Rather, my problem is that the spm8 and spm2 results from the same data ought to be identical when viewed in mricron, but they're far from it. When I use mricron to look at the results from the spm8-format images, combined across participants to create a t-image, I just get a single 'blob' spanning roughly half the brain. In contrast, when I used spm2-format previously on the same data, the t-image was much more meaningful; a posterior alpha power decrease in a set of regions corresponding to the 'task-positive network' (a network found in the results of an fMRI version of my experiment, and widely reported in the fMRI literature). This failure to replicate the spm2 results when using spm8 images from the same data leads me to suspect that something is wrong with the coordinates for spm8 format. However, after experimenting extensively with different cfg options I still haven't identified the problem. If I my structural MRIs have been saved to .mri files using CTF's MRIConverter program, which cfg options, particularly for coordinates, template images, and filetypes, should I specify before calling the ft_volumesegment, ft_prepare_singleshell, ft_sourceinterpolate, ft_volumenormalise, and ft_volumewrite functions? Or should I be calling a different set of functions now? Thanks again for your help, Jen On Thu, Feb 24, 2011 at 10:07 AM, Jen Whitman wrote: Great, thanks! I'll start the analysis with your new script today and will let you know how it works out. Jen On Thu, Feb 24, 2011 at 4:44 AM, jan-mathijs schoffelen < jan.schoffelen at donders.ru.nl> wrote: Dear Jen, I managed to reproduce your problem. The code was rather buggy and indeed ft_volumewrite did not behave as it should have. I now fixed it in the code and it should run fine now. Please find the updated file attached. It will be available on our ftp-server as of tonight. Please note that I updated the documentation, and changed the names of some of the options a bit. If you want to save your data in analyze-format, you should specify cfg.filetype = 'analyze_spm'. If you specify cfg.filetype = 'nifti', it should write out a volume to nifti-format, using SPM8. Best wishes, Jan-Mathijs On Feb 23, 2011, at 7:44 PM, Jen Whitman wrote: Dear Jan, Thanks for the quick reply. Yes, I have tried it out quite a few times now, experimenting with different settings in the cfgs. Below I'll paste the code I've been using to write images - first the code that successfully created spm2 images that produced good results, then the code used for creating nifti format images from the same data. The comments in this second part are at this point a bit of a maze of cfg options I've been changing back & forth. Any insights/suggestions regarding how to set up my cfgs to make this work would be greatly appreciated. Jen %%%%%%%% this code generated spm2-compatible images which did work (producing results that made sense). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% sourcetemp.avg.pow = (sourcetemp.avg.pow - sourcePre.avg.pow) ./ sourcePre.avg.pow; cfg = []; cfg.downsample = 2; sourcetempInt = sourceinterpolate(cfg, sourcetemp , mri); % projecting the plot onto a surface... cfg = []; cfg.coordinates = 'ctf'; cfg.template = '/home/common/matlab/spm2/templates/T1.mnc'; %this template is in MNI coordinates sourcetempIntN = volumenormalise(cfg, sourcetempInt); filename=[subj 'run' int2str(r) 'cond' int2str(cond) '_' int2str(f) 'HzWin' int2str(win) 'width750ms']; cfg=[]; cfg.parameter = 'avg.pow'; % string, describing the functional data to be processed, e.g. 'pow', 'coh' or 'nai' cfg.filename = [filename '.img']; %'testimageoutput_alphafreq'; % filename without the extension cfg.filetype = 'spm'; %'analyze', 'spm', 'vmp' or 'vmr' cfg.coordinates = 'spm'; %'spm, 'ctf' or empty for interactive (default = []) cfg.datatype = 'double'; %'float'; %'double'; %'bit1', 'uint8', 'int16', 'int32', 'float' or 'double' volumewrite(cfg, sourcetempIntN) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%% this code below hasn't worked yet... % I added cfg.spmversion = 'spm8'; % in the cfgs for the calls to ft_prepare_leadfield and ft_sourceanalysis, % and in the call to prepare_singleshell after calling volumesegment % I've also ensured that spm8 is the only spm version in my path, even in % the fieldtrip/external folder, and ensured that spm8 is installed properly % (files compiled correctly, etc..) sourcetemp.avg.pow = (sourcetemp.avg.pow - sourcePre.avg.pow) ./ sourcePre.avg.pow; filename=[subj 'run' int2str(r) 'cond' int2str(cond) '_' int2str(f) 'Hzspm8_FIXv9_Win' int2str(win) 'width750ms.img']; cfg = []; % cfg.coordinates = 'spm'; % changed for version 5 % cfg.spmversion = 'spm8'; % changed for version 5 cfg.downsample = 4; sourcetempInt = ft_sourceinterpolate(cfg, sourcetemp , mri); % projecting the plot onto a surface... cfg = []; %cfg.coordinates = 'spm'; % changed for version 5 %cfg.coordinates = 'ctf'; % changed for version 5 cfg.coordinates = 'spm'; % changed back to spm for version 9 cfg.downsample = 4; %cfg.spmversion = 'spm8'; % changed for version 6 (because this gets specified in volumewrite) cfg.template = 'Hmatrix/mask.nii.nii'; % basically equivalent to using spm8/templates/EPI.nii, except that mask.nii (produced from fmri data) has the desired voxel size % cfg.name = [filename]; % changed for version 6 %cfg.write= 'yes'; % changed for version 6 (when this was set to 'yes' there was no subsequent call to volumewrite) cfg.write= 'no'; % changed for version 6 sourcetempIntN = ft_volumenormalise(cfg, sourcetempInt); % this whole cfg and function call added for version 6 cfg=[]; % cfg.parameter = string, describing the functional data to be processed, e.g. 'pow', 'coh' or 'nai' % cfg.filename = filename without the extension % cfg.filetype = 'analyze', 'spm', 'vmp' or 'vmr' % cfg.vmpversion = 1 or 2 (default) version of the vmp-format to use % cfg.coordinates = 'spm, 'ctf' or empty for interactive (default = []) cfg.parameter='pow'; cfg.filename=filename; cfg.filetype = 'spm'; cfg.spmversion = 'SPM8'; % capitalized after first error message from vers 6 % cfg.dataformat='nifti'; % added after first error message from vers 6 % commented out after 2nd error message from vers 6 %cfg.vmpversion=2; % this is a filetype, like spm, so don't need to specify unless cfg.filetyp='vmp' cfg.coordinates='spm'; ft_volumewrite(cfg,sourcetempIntN); On Wed, Feb 23, 2011 at 7:50 AM, jan-mathijs schoffelen wrote: Dear Jen, I notice that indeed in the documentation section of ft_write_volume there is a FIXME behind nifti. Yet, nifti format seems to be supported by ft_write_volume (at least in a recent version of fieldtrip). Did you try it at all (and ran into problems) or were you held back by the FIXME statement? Could you just try it out using a recent fieldtrip function? Thanks and best wishes Jan-Mathijs On Feb 23, 2011, at 2:21 AM, Jen Whitman wrote: Hello, While writing beamformed images to spm2 format in a previous version of fieldtrip (now lost due to a computer crash), I was able to get nice-looking results; networks of brain regions consistent with existing literature. When I try to write images from the same dataset and the same analysis to spm8 format, my results (t-images computed across subjects) end up being single clusters spanning large sections of the brain (e.g. a 'blob' spanning all of one hemisphere but not the other). Unfortunately, some aspects of my planned data analyses cannot be performed on spm2 images, so I have to find a way of writing to successfully to nifti format. I just noticed that in the comments in the ft_write_volume function, which I am calling via ft_volumewrite, it says 'FIXME' next to nifti under the list of supported dataformats. Is there by any chance a patch out there for writing nifti images? Thanks! _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: pic1.png Type: image/png Size: 62738 bytes Desc: pic1.png URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: pic2.png Type: image/png Size: 106479 bytes Desc: pic2.png URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: pic3.png Type: image/png Size: 55419 bytes Desc: pic3.png URL: From jan.schoffelen at donders.ru.nl Tue Apr 12 21:17:59 2011 From: jan.schoffelen at donders.ru.nl (jan-mathijs schoffelen) Date: Tue, 12 Apr 2011 21:17:59 +0200 Subject: [FieldTrip] I think you solved the problem In-Reply-To: <72E993C35FB11743B79FF9286E5B6D8B02676264@Mail2-UKD.VMED.UKD> References: <72E993C35FB11743B79FF9286E5B6D8B02676142@Mail2-UKD.VMED.UKD> <7B5CA863-D143-404C-BCB9-805AA6E6E546@donders.ru.nl> <72E993C35FB11743B79FF9286E5B6D8B02676264@Mail2-UKD.VMED.UKD> Message-ID: Dear Jan, I suspect that your mri, as it comes out of ft_read_mri is already coregistered in neuromag space. After your realignment and after replacing mri.transform with real_mri.transform, the coordinate axes in your pic1 look strange. This I think causes the 'dropped pocket change'. What happens if you skip the ft_volumerealign step and call ft_volumesegment directly on the mri (with cfg.coordsys = 'neuromag', or, for what it's worth, without cfg.coordsys; in this case you will be able to verify the coordinate system)? Alternatively, if this doesn't work, could you replace mri.transform by eye(4) prior to calling ft_volumerealign and ft_volumesegment (both with cfg.coordsys = 'neuromag' and no further tampering with transformation matrices?). Thanks JM On Apr 12, 2011, at 8:49 PM, wrote: > Dear Jan-Mathijs, > > sorry, I think I was a bit too enthusiastic when I said everything > worked out wonderfully. It worked only once. After an afternoon of > confusion I concluded that on my first try I must have misspelled > cfg.coordsys=’neuromag’ on my calls to ft_volumerealign and > ft_volumesegment. In fact, the segmentation looks really bad with > these settings. What works for me is written underneath: > > mri = ft_read_mri('….fif'); > hdr=ft_read_header('…fif'); > mri.anatomy=double(mri.anatomy); > > %this is taken from the Neuromag GUI for MRI-MEG Integration > cfg=[]; > cfg.fiducial.rpa=[136.35 142.80 31.96]; > cfg.fiducial.nas=[47.84 101.80 100.10]; > cfg.fiducial.lpa=[139.22 146.17 162.69]; > > %go from neuromag voxel to neuromag head coordinates > cfg.coordsys='neuromag'; > cfg.method='fiducial'; > real_mri=ft_volumerealign(cfg,mri); > > %taking real_mri with its coordsys field will not work, so I take mri > mri.transform=real_mri.transform; > > cfg = []; > cfg.keepintermediate = 'no'; > cfg.write = 'no'; > segmentedmri = ft_volumesegment(cfg, mri); > > > Before segmentation the function shows some kind of brain (pic 1). > When segmentation is done the segmented brain looks good (pic 2) but > the brain does not fit the helmet (pic 3). It is looking at its feet > as if it dropped some pocket change. Do you know what is going on? > > Thanks, > jan > > Von: fieldtrip-bounces at donders.ru.nl [mailto:fieldtrip-bounces at donders.ru.nl > ] Im Auftrag von jan-mathijs schoffelen > Gesendet: Dienstag, 12. April 2011 12:11 > An: Email discussion list for the FieldTrip project > Betreff: Re: [FieldTrip] I think you solved the problem > > Dear Jan, > > Apart from not being properly aligned, the segmentation looks a bit > strange to me. I suspect that not everything went well here ;o). > Could you try the following: > > specify cfg.coordsys = 'neuromag', both in your call to > ft_volumerealign and in your call to ft_volumesegment. The > cfg.coordinates for ft_volumesegment has to be removed (actually it > is a deprecated option). The idea now is that mri-structures in > fieldtrip can have a coordsys field, which allows for more > transparent use of the different head coordinate system conventions. > This takes away the need for intermediately coregistering the MRI in > 'ctf'-convention, and would also take away your need to call > headcoordinates later on. > > Best wishes, > > Jan-Mathijs > > > On Apr 12, 2011, at 11:07 AM, duesseldorf.de> wrote: > > > Dear fieldtrip experts, > > I have two questions regarding head model creation. As noted on this > thread, the volumesegment function was updated and I tested it for > our Neuromag data. The segmentation is performed, but unfortunately > it is not aligned with the MRI in my case. Here is the code I am > using, the fieldtrip is from 9th April 2011. > > %read mri > mri = ft_read_mri(subject_files.fiff_mri); > mri.anatomy=double(mri.anatomy); > > %these are the fiducials for this subject taken from the Neuromag > GUI for coregistration > cfg=[]; > cfg.fiducial.rpa=[136.35 142.80 31.96]; > cfg.fiducial.nas=[47.84 101.80 100.10]; > cfg.fiducial.lpa=[139.22 146.17 162.69]; > > %define the head coordinate system according to CTF conventions > cfg.method='fiducial'; > real_mri=ft_volumerealign(cfg,mri); > > %segment > cfg = []; > cfg.template = '/data/apps/spm/spm8/templates/T1.nii'; > cfg.coordinates = 'ctf'; > cfg.keepintermediate = 'no'; > segmentedmri = ft_volumesegment(cfg, real_mri); > > %plot white matter > test=segmentedmri; > test.anatomy=real_mri.anatomy; > cfg=[]; > cfg.funparameter='white'; > ft_sourceplot(cfg,test); %see attached picture > > The other issue regards back-transformation from CTF to Neuromag > coordinates, which is necessary to make the head model fit the > sensors. My idea was to create an appropriate transformation matrix > like this. > > cd /net/avidya/storage/home/jan/fieldtrip-20110409/private > ctfmat=headcoordinates(nas,lpa,rpa,'ctf'); > nmmat=headcoordinates(nas,lpa,rpa,'neuromag'); > ctf_to_nm=nmmat/ctfmat; > > > And then to use it on the head model to bring it back into Neuromag > coordinates: > > %create single shell, realistic headmodel > cfg = []; > hdm = ft_prepare_singleshell(cfg,segmentedmri); > > % transformation of headmodel into Neuromag space > hdm.bnd.pnt=warp_apply(ctf_to_nm,hdm.bnd.pnt,'homogeneous'); > > Does this survive a sanity check? > > Best regards and thanks a lot, > > Jan > > > Von: fieldtrip-bounces at donders.ru.nl [mailto:fieldtrip-bounces at donders.ru.nl > ] Im Auftrag von Jen Whitman > Gesendet: Montag, 28. Februar 2011 22:32 > An: Email discussion list for the FieldTrip project > Betreff: [FieldTrip] I think you solved the problem > > I just checked, and when I re-ran my segmentation script with the > new Fieldtrip in order to use an spm8 template image, coordinates > got reversed. When I take out the calls to flipdim, they look fine > (see attached screenshots). That certainly explains the meaningless > results I was getting! > > Thanks for figuring that out, > > Jen > > On Mon, Feb 28, 2011 at 12:36 PM, jan-mathijs schoffelen > wrote: > Hi Jen, > > At first glance I have a comment on your script. You may need to > explicitly check the alignment of your segmented volume and the > original anatomy. A while a go some changes were made to > ft_volumesegment, taking away the need to do the flipdim(flipdim... > operations. I have posted this on the discussion list last January, > but you may not have noticed. > Anyway, if you now have used a recent version of FieldTrip for your > segmentation both the location of your dipole grid, and the volume > conductor model will not be adequately coregistered with the data, > which may lead to funky results to begin with. That's most likely > not related to the filetype in which the volumes are saved for later > use. > > Best wishes, > > Jan-Mathijs > > > > On Feb 28, 2011, at 8:59 PM, Jen Whitman wrote: > > > > Hello Jan, > > When calling volumesegment, I specified 'ctf' as the coordinate > system. The function I wrote to call volumesegment and > prepare_singleshell for each subject and save the results is pasted > below, with a couple of comments added for clarity. > Over the weekend I tried specifying the coordinate system in the > call to ft_volumenormalise as 'ctf' rather than 'spm', and commented > out all the lines that said cfg.spmversion = 'spm8'; before calling > a function. However, that created worse results, as each plot > involved stripes of activation and empty voxels, suggesting that > 'ctf' was not the correct coordinate system to specify. > > Thanks for the attached script. Looking in that the comments in > that, I suspect that the solution to my problems will be to specify > my filetype as nifti_img rather than nifti. I'll let you know how > that goes. > > Jen > > ------------------------------------------------------------------------------------------------------------ > % the variable subj is simply a string consisting of a subject > number (e.g. 's05') which can be a folder name or part of a filename > function [vol mri segmentedmri > segmentedmriF]=call_volume_segment_function_spm8(subj) > cfg.spmversion = 'spm8'; > cfg.template = '/home/woodwardlab/spm8/templates/EPI.nii'; > %cfg.template='/home/common/matlab/spm2/templates/T1.mnc'; > cfg.name=[subj '_volseg']; > cfg.write='yes'; > cfg.smooth='no'; > cfg.coordinates='ctf'; > mri=read_mri([subj '/mri/' subj 'head.mri']); % made with CTF > mriConverter and mriViewer software, after fiducials were marked > segmentedmri = volumesegment(cfg, mri); > segmentedmriF = segmentedmri; > segmentedmriF.gray = flipdim(flipdim(flipdim(segmentedmriF.gray,3), > 2),1); > segmentedmriF.white = flipdim(flipdim(flipdim(segmentedmriF.white,3), > 2),1); > segmentedmriF.csf = flipdim(flipdim(flipdim(segmentedmriF.csf,3), > 2),1); > segmentedmriF.transform = mri.transform; > segmentedmriF.anatomy = mri.anatomy; > cfg = []; > cfg.spmversion = 'spm8'; > vol = prepare_singleshell(cfg, segmentedmriF); > eval(['save ' subj '/meg/mrisegmented.mat mri segmentedmri > segmentedmriF vol']) > > > > > On Sat, Feb 26, 2011 at 5:26 AM, jan-mathijs schoffelen > wrote: > Dear Jen, > > I do not manage to reproduce your issue, when only focussing on the > ft_volumewrite and visualization part of your pipeline. See attached > script, and yet an updated version of ft_volumewrite which you need > to (hopefully) draw the same conclusion as I did. > Yet, I only now realize that your question may pertain to the entire > pipeline. It could be that something is going wrong there. > I only see now that in the part of your script of which you reported > that it gave 'good' results, you specify cfg.coordinates = 'ctf' > before calling ft_volumenormalise. I assume this is correct, because > the coordinate system your source-reconstructed data lives in, is > according to the CTF-convention, and not according to the SPM- > convention. On the other hand, the template for the spatial > normalization lives in the SPM-coordinate system. In order for the > spatial normalization to work OK, Fieldtrip tries to convert from > one coordinate system to the other (once again, this is appropriate > behaviour), before doing the actual normalization. It seems that at > least in the script you sent along, in the final (not working > version), you specified cfg.coordinates = 'spm' prior to calling > ft_volumenormalise. This is probably wrong. > Another important point that should be mentioned, is that the > coordinate systems in which the functional data and the anatomical > data live should be the same for the ft_sourceinterpolate to make > sense. In other words, if your source reconstructed images are > defined on a 3D grid of positions in CTF-space, the mri.transform of > your anatomy should describe a transformation from voxel to CTF-space. > I think you may want to revisit step by step this part of the > pipeline; I don't think the problem lies in the writing. > A final possibility of course is that Mricron is misbehaving... > > Best, > > Jan-Mathijs > > > > > > > On Feb 25, 2011, at 9:44 PM, Jen Whitman wrote: > > > > Hi Jan, > > I tried re-running the analysis with the new script you sent me, and > the latest version of fieldtrip (since I needed ft_get_opt as well), > but the spm8 images being written are still producing flawed > results. It's the same problem as I mentioned briefly in my previous > post. I am not getting any error messages when writing these images. > Rather, my problem is that the spm8 and spm2 results from the same > data ought to be identical when viewed in mricron, but they're far > from it. When I use mricron to look at the results from the spm8- > format images, combined across participants to create a t-image, I > just get a single 'blob' spanning roughly half the brain. In > contrast, when I used spm2-format previously on the same data, the t- > image was much more meaningful; a posterior alpha power decrease in > a set of regions corresponding to the 'task-positive network' (a > network found in the results of an fMRI version of my experiment, > and widely reported in the fMRI literature). > > This failure to replicate the spm2 results when using spm8 images > from the same data leads me to suspect that something is wrong with > the coordinates for spm8 format. However, after experimenting > extensively with different cfg options I still haven't identified > the problem. If I my structural MRIs have been saved to .mri files > using CTF's MRIConverter program, which cfg options, particularly > for coordinates, template images, and filetypes, should I specify > before calling the ft_volumesegment, ft_prepare_singleshell, > ft_sourceinterpolate, ft_volumenormalise, and ft_volumewrite > functions? Or should I be calling a different set of functions now? > > Thanks again for your help, > > Jen > > On Thu, Feb 24, 2011 at 10:07 AM, Jen Whitman > wrote: > Great, thanks! > > I'll start the analysis with your new script today and will let you > know how it works out. > > Jen > > On Thu, Feb 24, 2011 at 4:44 AM, jan-mathijs schoffelen > wrote: > Dear Jen, > > I managed to reproduce your problem. The code was rather buggy and > indeed ft_volumewrite did not behave as it should have. I now fixed > it in the code and it should run fine now. Please find the updated > file attached. It will be available on our ftp-server as of tonight. > Please note that I updated the documentation, and changed the names > of some of the options a bit. If you want to save your data in > analyze-format, you should specify cfg.filetype = 'analyze_spm'. If > you specify cfg.filetype = 'nifti', it should write out a volume to > nifti-format, using SPM8. > > Best wishes, > > Jan-Mathijs > > > > > > On Feb 23, 2011, at 7:44 PM, Jen Whitman wrote: > >> >> Dear Jan, >> >> Thanks for the quick reply. Yes, I have tried it out quite a few >> times now, experimenting with different settings in the cfgs. Below >> I'll paste the code I've been using to write images - first the >> code that successfully created spm2 images that produced good >> results, then the code used for creating nifti format images from >> the same data. The comments in this second part are at this point a >> bit of a maze of cfg options I've been changing back & forth. Any >> insights/suggestions regarding how to set up my cfgs to make this >> work would be greatly appreciated. >> >> Jen >> >> >> %%%%%%%% this code generated spm2-compatible images which did work >> (producing results that made sense). >> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% >> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% >> >> sourcetemp.avg.pow = (sourcetemp.avg.pow - >> sourcePre.avg.pow) ./ sourcePre.avg.pow; >> >> cfg = []; >> cfg.downsample = 2; >> sourcetempInt = sourceinterpolate(cfg, sourcetemp , mri); >> >> % projecting the plot onto a surface... >> cfg = []; >> cfg.coordinates = 'ctf'; >> cfg.template = '/home/common/matlab/spm2/templates/T1.mnc'; >> %this template is in MNI coordinates >> sourcetempIntN = volumenormalise(cfg, sourcetempInt); >> >> filename=[subj 'run' int2str(r) 'cond' int2str(cond) '_' >> int2str(f) 'HzWin' int2str(win) 'width750ms']; >> cfg=[]; >> cfg.parameter = 'avg.pow'; % string, describing the >> functional data to be processed, e.g. 'pow', 'coh' or 'nai' >> cfg.filename = [filename '.img']; >> %'testimageoutput_alphafreq'; % filename without the extension >> cfg.filetype = 'spm'; %'analyze', 'spm', 'vmp' or 'vmr' >> cfg.coordinates = 'spm'; %'spm, 'ctf' or empty for >> interactive (default = []) >> cfg.datatype = 'double'; %'float'; %'double'; %'bit1', 'uint8', >> 'int16', 'int32', 'float' or 'double' >> >> volumewrite(cfg, sourcetempIntN) >> >> >> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% >> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% >> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% >> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% >> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% >> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% >> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% >> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% >> %%%%% this code below hasn't worked yet... >> >> % I added cfg.spmversion = 'spm8'; >> % in the cfgs for the calls to ft_prepare_leadfield and >> ft_sourceanalysis, >> % and in the call to prepare_singleshell after calling volumesegment >> >> % I've also ensured that spm8 is the only spm version in my path, >> even in >> % the fieldtrip/external folder, and ensured that spm8 is installed >> properly >> % (files compiled correctly, etc..) >> >> sourcetemp.avg.pow = (sourcetemp.avg.pow - >> sourcePre.avg.pow) ./ sourcePre.avg.pow; >> >> filename=[subj 'run' int2str(r) 'cond' int2str(cond) '_' >> int2str(f) 'Hzspm8_FIXv9_Win' int2str(win) 'width750ms.img']; >> >> cfg = []; >> % cfg.coordinates = 'spm'; % changed for version 5 >> % cfg.spmversion = 'spm8'; % changed for version 5 >> cfg.downsample = 4; >> sourcetempInt = ft_sourceinterpolate(cfg, sourcetemp , mri); >> >> >> % projecting the plot onto a surface... >> cfg = []; >> %cfg.coordinates = 'spm'; % changed for version 5 >> %cfg.coordinates = 'ctf'; % changed for version 5 >> cfg.coordinates = 'spm'; % changed back to spm for version 9 >> cfg.downsample = 4; >> %cfg.spmversion = 'spm8'; % changed for version 6 (because this >> gets specified in volumewrite) >> cfg.template = 'Hmatrix/mask.nii.nii'; % basically equivalent >> to using spm8/templates/EPI.nii, except that mask.nii (produced >> from fmri data) has the desired voxel size >> % cfg.name = [filename]; % changed for version 6 >> %cfg.write= 'yes'; % changed for version 6 (when this was set >> to 'yes' there was no subsequent call to volumewrite) >> cfg.write= 'no'; % changed for version 6 >> sourcetempIntN = ft_volumenormalise(cfg, sourcetempInt); >> >> % this whole cfg and function call added for version 6 >> cfg=[]; >> % cfg.parameter = string, describing the functional data >> to be processed, e.g. 'pow', 'coh' or 'nai' >> % cfg.filename = filename without the extension >> % cfg.filetype = 'analyze', 'spm', 'vmp' or 'vmr' >> % cfg.vmpversion = 1 or 2 (default) version of the vmp-format >> to use >> % cfg.coordinates = 'spm, 'ctf' or empty for interactive >> (default = []) >> cfg.parameter='pow'; >> cfg.filename=filename; >> cfg.filetype = 'spm'; >> cfg.spmversion = 'SPM8'; % capitalized after first error >> message from vers 6 >> % cfg.dataformat='nifti'; % added after first error message from >> vers 6 >> % commented out after 2nd error >> message from vers 6 >> %cfg.vmpversion=2; % this is a filetype, like spm, so don't >> need to specify unless cfg.filetyp='vmp' >> cfg.coordinates='spm'; >> ft_volumewrite(cfg,sourcetempIntN); >> >> >> >> >> >> >> On Wed, Feb 23, 2011 at 7:50 AM, jan-mathijs schoffelen > > wrote: >> Dear Jen, >> >> I notice that indeed in the documentation section of >> ft_write_volume there is a FIXME behind nifti. Yet, nifti format >> seems to be supported by ft_write_volume (at least in a recent >> version of fieldtrip). Did you try it at all (and ran into >> problems) or were you held back by the FIXME statement? Could you >> just try it out using a recent fieldtrip function? >> >> Thanks and best wishes >> >> Jan-Mathijs >> >> >> >> On Feb 23, 2011, at 2:21 AM, Jen Whitman wrote: >> >> Hello, >> >> While writing beamformed images to spm2 format in a previous >> version of fieldtrip (now lost due to a computer crash), I was able >> to get nice-looking results; networks of brain regions consistent >> with existing literature. When I try to write images from the same >> dataset and the same analysis to spm8 format, my results (t-images >> computed across subjects) end up being single clusters spanning >> large sections of the brain (e.g. a 'blob' spanning all of one >> hemisphere but not the other). Unfortunately, some aspects of my >> planned data analyses cannot be performed on spm2 images, so I have >> to find a way of writing to successfully to nifti format. >> >> I just noticed that in the comments in the ft_write_volume >> function, which I am calling via ft_volumewrite, it says 'FIXME' >> next to nifti under the list of supported dataformats. Is there by >> any chance a patch out there for writing nifti images? >> >> Thanks! >> >> _______________________________________________ >> fieldtrip mailing list >> fieldtrip at donders.ru.nl >> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip >> >> Dr. J.M. (Jan-Mathijs) Schoffelen >> Donders Institute for Brain, Cognition and Behaviour, >> Centre for Cognitive Neuroimaging, >> Radboud University Nijmegen, The Netherlands >> J.Schoffelen at donders.ru.nl >> Telephone: 0031-24-3614793 >> >> _______________________________________________ >> fieldtrip mailing list >> fieldtrip at donders.ru.nl >> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip >> >> _______________________________________________ >> fieldtrip mailing list >> fieldtrip at donders.ru.nl >> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > > > Dr. J.M. (Jan-Mathijs) Schoffelen > Donders Institute for Brain, Cognition and Behaviour, > Centre for Cognitive Neuroimaging, > Radboud University Nijmegen, The Netherlands > J.Schoffelen at donders.ru.nl > Telephone: 0031-24-3614793 > > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > > Dr. J.M. (Jan-Mathijs) Schoffelen > Donders Institute for Brain, Cognition and Behaviour, > Centre for Cognitive Neuroimaging, > Radboud University Nijmegen, The Netherlands > J.Schoffelen at donders.ru.nl > Telephone: 0031-24-3614793 > > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > > Dr. J.M. (Jan-Mathijs) Schoffelen > Donders Institute for Brain, Cognition and Behaviour, > Centre for Cognitive Neuroimaging, > Radboud University Nijmegen, The Netherlands > J.Schoffelen at donders.ru.nl > Telephone: 0031-24-3614793 > > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > > Dr. J.M. (Jan-Mathijs) Schoffelen > Donders Institute for Brain, Cognition and Behaviour, > Centre for Cognitive Neuroimaging, > Radboud University Nijmegen, The Netherlands > J.Schoffelen at donders.ru.nl > Telephone: 0031-24-3614793 > > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 -------------- next part -------------- An HTML attachment was scrubbed... URL: From Jan.Hirschmann at med.uni-duesseldorf.de Wed Apr 13 14:31:58 2011 From: Jan.Hirschmann at med.uni-duesseldorf.de (Jan.Hirschmann at med.uni-duesseldorf.de) Date: Wed, 13 Apr 2011 14:31:58 +0200 Subject: [FieldTrip] I think you solved the problem In-Reply-To: References: <72E993C35FB11743B79FF9286E5B6D8B02676142@Mail2-UKD.VMED.UKD><7B5CA863-D143-404C-BCB9-805AA6E6E546@donders.ru.nl><72E993C35FB11743B79FF9286E5B6D8B02676264@Mail2-UKD.VMED.UKD> Message-ID: <72E993C35FB11743B79FF9286E5B6D8B026763B8@Mail2-UKD.VMED.UKD> Dear Jan-Mathijs, I think we solved the problem. Everthing is like you said in the first place. ft_volumerealign and ft_volumesegment should be called with cfg.coordsys='neuromag'. The only thing that was wrong is that for the voxel coordinates read from the Neuromag GUI x and y should be swapped. For anyone interested I attach a script that is meant to be easy-to-use for beginners. Thank you very much for your time! ________________________________ Von: fieldtrip-bounces at donders.ru.nl [mailto:fieldtrip-bounces at donders.ru.nl] Im Auftrag von jan-mathijs schoffelen Gesendet: Dienstag, 12. April 2011 21:18 An: Email discussion list for the FieldTrip project Betreff: Re: [FieldTrip] I think you solved the problem Dear Jan, I suspect that your mri, as it comes out of ft_read_mri is already coregistered in neuromag space. After your realignment and after replacing mri.transform with real_mri.transform, the coordinate axes in your pic1 look strange. This I think causes the 'dropped pocket change'. What happens if you skip the ft_volumerealign step and call ft_volumesegment directly on the mri (with cfg.coordsys = 'neuromag', or, for what it's worth, without cfg.coordsys; in this case you will be able to verify the coordinate system)? Alternatively, if this doesn't work, could you replace mri.transform by eye(4) prior to calling ft_volumerealign and ft_volumesegment (both with cfg.coordsys = 'neuromag' and no further tampering with transformation matrices?). Thanks JM On Apr 12, 2011, at 8:49 PM, < Jan.Hirschmann at med.uni-duesseldorf.de> wrote: Dear Jan-Mathijs, sorry, I think I was a bit too enthusiastic when I said everything worked out wonderfully. It worked only once. After an afternoon of confusion I concluded that on my first try I must have misspelled cfg.coordsys='neuromag' on my calls to ft_volumerealign and ft_volumesegment. In fact, the segmentation looks really bad with these settings. What works for me is written underneath: mri = ft_read_mri('....fif'); hdr=ft_read_header('...fif'); mri.anatomy=double(mri.anatomy); %this is taken from the Neuromag GUI for MRI-MEG Integration cfg=[]; cfg.fiducial.rpa=[136.35 142.80 31.96]; cfg.fiducial.nas=[47.84 101.80 100.10]; cfg.fiducial.lpa=[139.22 146.17 162.69]; %go from neuromag voxel to neuromag head coordinates cfg.coordsys='neuromag'; cfg.method='fiducial'; real_mri=ft_volumerealign(cfg,mri); %taking real_mri with its coordsys field will not work, so I take mri mri.transform=real_mri.transform; cfg = []; cfg.keepintermediate = 'no'; cfg.write = 'no'; segmentedmri = ft_volumesegment(cfg, mri); Before segmentation the function shows some kind of brain (pic 1). When segmentation is done the segmented brain looks good (pic 2) but the brain does not fit the helmet (pic 3). It is looking at its feet as if it dropped some pocket change. Do you know what is going on? Thanks, jan ________________________________ Von: fieldtrip-bounces at donders.ru.nl [ mailto:fieldtrip-bounces at donders.ru.nl] Im Auftrag von jan-mathijs schoffelen Gesendet: Dienstag, 12. April 2011 12:11 An: Email discussion list for the FieldTrip project Betreff: Re: [FieldTrip] I think you solved the problem Dear Jan, Apart from not being properly aligned, the segmentation looks a bit strange to me. I suspect that not everything went well here ;o). Could you try the following: specify cfg.coordsys = 'neuromag', both in your call to ft_volumerealign and in your call to ft_volumesegment. The cfg.coordinates for ft_volumesegment has to be removed (actually it is a deprecated option). The idea now is that mri-structures in fieldtrip can have a coordsys field, which allows for more transparent use of the different head coordinate system conventions. This takes away the need for intermediately coregistering the MRI in 'ctf'-convention, and would also take away your need to call headcoordinates later on. Best wishes, Jan-Mathijs On Apr 12, 2011, at 11:07 AM, < Jan.Hirschmann at med.uni-duesseldorf.de> wrote: Dear fieldtrip experts, I have two questions regarding head model creation. As noted on this thread, the volumesegment function was updated and I tested it for our Neuromag data. The segmentation is performed, but unfortunately it is not aligned with the MRI in my case. Here is the code I am using, the fieldtrip is from 9th April 2011. %read mri mri = ft_read_mri(subject_files.fiff_mri); mri.anatomy=double(mri.anatomy); %these are the fiducials for this subject taken from the Neuromag GUI for coregistration cfg=[]; cfg.fiducial.rpa=[136.35 142.80 31.96]; cfg.fiducial.nas=[47.84 101.80 100.10]; cfg.fiducial.lpa=[139.22 146.17 162.69]; %define the head coordinate system according to CTF conventions cfg.method='fiducial'; real_mri=ft_volumerealign(cfg,mri); %segment cfg = []; cfg.template = '/data/apps/spm/spm8/templates/T1.nii'; cfg.coordinates = 'ctf'; cfg.keepintermediate = 'no'; segmentedmri = ft_volumesegment(cfg, real_mri); %plot white matter test=segmentedmri; test.anatomy=real_mri.anatomy; cfg=[]; cfg.funparameter='white'; ft_sourceplot(cfg,test); %see attached picture The other issue regards back-transformation from CTF to Neuromag coordinates, which is necessary to make the head model fit the sensors. My idea was to create an appropriate transformation matrix like this. cd /net/avidya/storage/home/jan/fieldtrip-20110409/private ctfmat=headcoordinates(nas,lpa,rpa,'ctf'); nmmat=headcoordinates(nas,lpa,rpa,'neuromag'); ctf_to_nm=nmmat/ctfmat; And then to use it on the head model to bring it back into Neuromag coordinates: %create single shell, realistic headmodel cfg = []; hdm = ft_prepare_singleshell(cfg,segmentedmri); % transformation of headmodel into Neuromag space hdm.bnd.pnt=warp_apply(ctf_to_nm,hdm.bnd.pnt,'homogeneous'); Does this survive a sanity check? Best regards and thanks a lot, Jan ________________________________ Von: fieldtrip-bounces at donders.ru.nl [ mailto:fieldtrip-bounces at donders.ru.nl] Im Auftrag von Jen Whitman Gesendet: Montag, 28. Februar 2011 22:32 An: Email discussion list for the FieldTrip project Betreff: [FieldTrip] I think you solved the problem I just checked, and when I re-ran my segmentation script with the new Fieldtrip in order to use an spm8 template image, coordinates got reversed. When I take out the calls to flipdim, they look fine (see attached screenshots). That certainly explains the meaningless results I was getting! Thanks for figuring that out, Jen On Mon, Feb 28, 2011 at 12:36 PM, jan-mathijs schoffelen < jan.schoffelen at donders.ru.nl> wrote: Hi Jen, At first glance I have a comment on your script. You may need to explicitly check the alignment of your segmented volume and the original anatomy. A while a go some changes were made to ft_volumesegment, taking away the need to do the flipdim(flipdim... operations. I have posted this on the discussion list last January, but you may not have noticed. Anyway, if you now have used a recent version of FieldTrip for your segmentation both the location of your dipole grid, and the volume conductor model will not be adequately coregistered with the data, which may lead to funky results to begin with. That's most likely not related to the filetype in which the volumes are saved for later use. Best wishes, Jan-Mathijs On Feb 28, 2011, at 8:59 PM, Jen Whitman wrote: Hello Jan, When calling volumesegment, I specified 'ctf' as the coordinate system. The function I wrote to call volumesegment and prepare_singleshell for each subject and save the results is pasted below, with a couple of comments added for clarity. Over the weekend I tried specifying the coordinate system in the call to ft_volumenormalise as 'ctf' rather than 'spm', and commented out all the lines that said cfg.spmversion = 'spm8'; before calling a function. However, that created worse results, as each plot involved stripes of activation and empty voxels, suggesting that 'ctf' was not the correct coordinate system to specify. Thanks for the attached script. Looking in that the comments in that, I suspect that the solution to my problems will be to specify my filetype as nifti_img rather than nifti. I'll let you know how that goes. Jen ------------------------------------------------------------------------ ------------------------------------ % the variable subj is simply a string consisting of a subject number (e.g. 's05') which can be a folder name or part of a filename function [vol mri segmentedmri segmentedmriF]=call_volume_segment_function_spm8(subj) cfg.spmversion = 'spm8'; cfg.template = '/home/woodwardlab/spm8/templates/EPI.nii'; %cfg.template='/home/common/matlab/spm2/templates/T1.mnc'; cfg.name=[subj '_volseg']; cfg.write='yes'; cfg.smooth='no'; cfg.coordinates='ctf'; mri=read_mri([subj '/mri/' subj 'head.mri']); % made with CTF mriConverter and mriViewer software, after fiducials were marked segmentedmri = volumesegment(cfg, mri); segmentedmriF = segmentedmri; segmentedmriF.gray = flipdim(flipdim(flipdim(segmentedmriF.gray,3),2),1); segmentedmriF.white = flipdim(flipdim(flipdim(segmentedmriF.white,3),2),1); segmentedmriF.csf = flipdim(flipdim(flipdim(segmentedmriF.csf,3),2),1); segmentedmriF.transform = mri.transform; segmentedmriF.anatomy = mri.anatomy; cfg = []; cfg.spmversion = 'spm8'; vol = prepare_singleshell(cfg, segmentedmriF); eval(['save ' subj '/meg/mrisegmented.mat mri segmentedmri segmentedmriF vol']) On Sat, Feb 26, 2011 at 5:26 AM, jan-mathijs schoffelen < jan.schoffelen at donders.ru.nl> wrote: Dear Jen, I do not manage to reproduce your issue, when only focussing on the ft_volumewrite and visualization part of your pipeline. See attached script, and yet an updated version of ft_volumewrite which you need to (hopefully) draw the same conclusion as I did. Yet, I only now realize that your question may pertain to the entire pipeline. It could be that something is going wrong there. I only see now that in the part of your script of which you reported that it gave 'good' results, you specify cfg.coordinates = 'ctf' before calling ft_volumenormalise. I assume this is correct, because the coordinate system your source-reconstructed data lives in, is according to the CTF-convention, and not according to the SPM-convention. On the other hand, the template for the spatial normalization lives in the SPM-coordinate system. In order for the spatial normalization to work OK, Fieldtrip tries to convert from one coordinate system to the other (once again, this is appropriate behaviour), before doing the actual normalization. It seems that at least in the script you sent along, in the final (not working version), you specified cfg.coordinates = 'spm' prior to calling ft_volumenormalise. This is probably wrong. Another important point that should be mentioned, is that the coordinate systems in which the functional data and the anatomical data live should be the same for the ft_sourceinterpolate to make sense. In other words, if your source reconstructed images are defined on a 3D grid of positions in CTF-space, the mri.transform of your anatomy should describe a transformation from voxel to CTF-space. I think you may want to revisit step by step this part of the pipeline; I don't think the problem lies in the writing. A final possibility of course is that Mricron is misbehaving... Best, Jan-Mathijs On Feb 25, 2011, at 9:44 PM, Jen Whitman wrote: Hi Jan, I tried re-running the analysis with the new script you sent me, and the latest version of fieldtrip (since I needed ft_get_opt as well), but the spm8 images being written are still producing flawed results. It's the same problem as I mentioned briefly in my previous post. I am not getting any error messages when writing these images. Rather, my problem is that the spm8 and spm2 results from the same data ought to be identical when viewed in mricron, but they're far from it. When I use mricron to look at the results from the spm8-format images, combined across participants to create a t-image, I just get a single 'blob' spanning roughly half the brain. In contrast, when I used spm2-format previously on the same data, the t-image was much more meaningful; a posterior alpha power decrease in a set of regions corresponding to the 'task-positive network' (a network found in the results of an fMRI version of my experiment, and widely reported in the fMRI literature). This failure to replicate the spm2 results when using spm8 images from the same data leads me to suspect that something is wrong with the coordinates for spm8 format. However, after experimenting extensively with different cfg options I still haven't identified the problem. If I my structural MRIs have been saved to .mri files using CTF's MRIConverter program, which cfg options, particularly for coordinates, template images, and filetypes, should I specify before calling the ft_volumesegment, ft_prepare_singleshell, ft_sourceinterpolate, ft_volumenormalise, and ft_volumewrite functions? Or should I be calling a different set of functions now? Thanks again for your help, Jen On Thu, Feb 24, 2011 at 10:07 AM, Jen Whitman wrote: Great, thanks! I'll start the analysis with your new script today and will let you know how it works out. Jen On Thu, Feb 24, 2011 at 4:44 AM, jan-mathijs schoffelen < jan.schoffelen at donders.ru.nl> wrote: Dear Jen, I managed to reproduce your problem. The code was rather buggy and indeed ft_volumewrite did not behave as it should have. I now fixed it in the code and it should run fine now. Please find the updated file attached. It will be available on our ftp-server as of tonight. Please note that I updated the documentation, and changed the names of some of the options a bit. If you want to save your data in analyze-format, you should specify cfg.filetype = 'analyze_spm'. If you specify cfg.filetype = 'nifti', it should write out a volume to nifti-format, using SPM8. Best wishes, Jan-Mathijs On Feb 23, 2011, at 7:44 PM, Jen Whitman wrote: Dear Jan, Thanks for the quick reply. Yes, I have tried it out quite a few times now, experimenting with different settings in the cfgs. Below I'll paste the code I've been using to write images - first the code that successfully created spm2 images that produced good results, then the code used for creating nifti format images from the same data. The comments in this second part are at this point a bit of a maze of cfg options I've been changing back & forth. Any insights/suggestions regarding how to set up my cfgs to make this work would be greatly appreciated. Jen %%%%%%%% this code generated spm2-compatible images which did work (producing results that made sense). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% sourcetemp.avg.pow = (sourcetemp.avg.pow - sourcePre.avg.pow) ./ sourcePre.avg.pow; cfg = []; cfg.downsample = 2; sourcetempInt = sourceinterpolate(cfg, sourcetemp , mri); % projecting the plot onto a surface... cfg = []; cfg.coordinates = 'ctf'; cfg.template = '/home/common/matlab/spm2/templates/T1.mnc'; %this template is in MNI coordinates sourcetempIntN = volumenormalise(cfg, sourcetempInt); filename=[subj 'run' int2str(r) 'cond' int2str(cond) '_' int2str(f) 'HzWin' int2str(win) 'width750ms']; cfg=[]; cfg.parameter = 'avg.pow'; % string, describing the functional data to be processed, e.g. 'pow', 'coh' or 'nai' cfg.filename = [filename '.img']; %'testimageoutput_alphafreq'; % filename without the extension cfg.filetype = 'spm'; %'analyze', 'spm', 'vmp' or 'vmr' cfg.coordinates = 'spm'; %'spm, 'ctf' or empty for interactive (default = []) cfg.datatype = 'double'; %'float'; %'double'; %'bit1', 'uint8', 'int16', 'int32', 'float' or 'double' volumewrite(cfg, sourcetempIntN) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%% this code below hasn't worked yet... % I added cfg.spmversion = 'spm8'; % in the cfgs for the calls to ft_prepare_leadfield and ft_sourceanalysis, % and in the call to prepare_singleshell after calling volumesegment % I've also ensured that spm8 is the only spm version in my path, even in % the fieldtrip/external folder, and ensured that spm8 is installed properly % (files compiled correctly, etc..) sourcetemp.avg.pow = (sourcetemp.avg.pow - sourcePre.avg.pow) ./ sourcePre.avg.pow; filename=[subj 'run' int2str(r) 'cond' int2str(cond) '_' int2str(f) 'Hzspm8_FIXv9_Win' int2str(win) 'width750ms.img']; cfg = []; % cfg.coordinates = 'spm'; % changed for version 5 % cfg.spmversion = 'spm8'; % changed for version 5 cfg.downsample = 4; sourcetempInt = ft_sourceinterpolate(cfg, sourcetemp , mri); % projecting the plot onto a surface... cfg = []; %cfg.coordinates = 'spm'; % changed for version 5 %cfg.coordinates = 'ctf'; % changed for version 5 cfg.coordinates = 'spm'; % changed back to spm for version 9 cfg.downsample = 4; %cfg.spmversion = 'spm8'; % changed for version 6 (because this gets specified in volumewrite) cfg.template = 'Hmatrix/mask.nii.nii'; % basically equivalent to using spm8/templates/EPI.nii, except that mask.nii (produced from fmri data) has the desired voxel size % cfg.name = [filename]; % changed for version 6 %cfg.write= 'yes'; % changed for version 6 (when this was set to 'yes' there was no subsequent call to volumewrite) cfg.write= 'no'; % changed for version 6 sourcetempIntN = ft_volumenormalise(cfg, sourcetempInt); % this whole cfg and function call added for version 6 cfg=[]; % cfg.parameter = string, describing the functional data to be processed, e.g. 'pow', 'coh' or 'nai' % cfg.filename = filename without the extension % cfg.filetype = 'analyze', 'spm', 'vmp' or 'vmr' % cfg.vmpversion = 1 or 2 (default) version of the vmp-format to use % cfg.coordinates = 'spm, 'ctf' or empty for interactive (default = []) cfg.parameter='pow'; cfg.filename=filename; cfg.filetype = 'spm'; cfg.spmversion = 'SPM8'; % capitalized after first error message from vers 6 % cfg.dataformat='nifti'; % added after first error message from vers 6 % commented out after 2nd error message from vers 6 %cfg.vmpversion=2; % this is a filetype, like spm, so don't need to specify unless cfg.filetyp='vmp' cfg.coordinates='spm'; ft_volumewrite(cfg,sourcetempIntN); On Wed, Feb 23, 2011 at 7:50 AM, jan-mathijs schoffelen wrote: Dear Jen, I notice that indeed in the documentation section of ft_write_volume there is a FIXME behind nifti. Yet, nifti format seems to be supported by ft_write_volume (at least in a recent version of fieldtrip). Did you try it at all (and ran into problems) or were you held back by the FIXME statement? Could you just try it out using a recent fieldtrip function? Thanks and best wishes Jan-Mathijs On Feb 23, 2011, at 2:21 AM, Jen Whitman wrote: Hello, While writing beamformed images to spm2 format in a previous version of fieldtrip (now lost due to a computer crash), I was able to get nice-looking results; networks of brain regions consistent with existing literature. When I try to write images from the same dataset and the same analysis to spm8 format, my results (t-images computed across subjects) end up being single clusters spanning large sections of the brain (e.g. a 'blob' spanning all of one hemisphere but not the other). Unfortunately, some aspects of my planned data analyses cannot be performed on spm2 images, so I have to find a way of writing to successfully to nifti format. I just noticed that in the comments in the ft_write_volume function, which I am calling via ft_volumewrite, it says 'FIXME' next to nifti under the list of supported dataformats. Is there by any chance a patch out there for writing nifti images? Thanks! _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: headmodel_with_neuromag.m Type: application/octet-stream Size: 2780 bytes Desc: headmodel_with_neuromag.m URL: From jan.schoffelen at donders.ru.nl Wed Apr 13 16:57:07 2011 From: jan.schoffelen at donders.ru.nl (jan-mathijs schoffelen) Date: Wed, 13 Apr 2011 16:57:07 +0200 Subject: [FieldTrip] I think you solved the problem In-Reply-To: <72E993C35FB11743B79FF9286E5B6D8B026763B8@Mail2-UKD.VMED.UKD> References: <72E993C35FB11743B79FF9286E5B6D8B02676142@Mail2-UKD.VMED.UKD><7B5CA863-D143-404C-BCB9-805AA6E6E546@donders.ru.nl><72E993C35FB11743B79FF9286E5B6D8B02676264@Mail2-UKD.VMED.UKD> <72E993C35FB11743B79FF9286E5B6D8B026763B8@Mail2-UKD.VMED.UKD> Message-ID: <5AC469DB-D5B1-4E3C-AE21-01A53AE94A26@donders.ru.nl> Dear Jan, No problem. Thanks for the script. If you feel up to it, you are kindly invited to update the documentation on the fieldtrip wiki as well. If I recall correctly, at some point Hanneke added some documentation about how to create MNI-based dipole grids for neuromag data. A lot of the intermediate steps have now become obsolete and this part of the wiki can be substantially cleaned. Thanks, Jan-Mathijs On Apr 13, 2011, at 2:31 PM, wrote: > Dear Jan-Mathijs, > > I think we solved the problem. Everthing is like you said in the > first place. ft_volumerealign and ft_volumesegment should be called > with cfg.coordsys=’neuromag’. The only thing that was wrong is that > for the voxel coordinates read from the Neuromag GUI x and y should > be swapped. For anyone interested I attach a script that is meant to > be easy-to-use for beginners. > > Thank you very much for your time! > Von: fieldtrip-bounces at donders.ru.nl [mailto:fieldtrip-bounces at donders.ru.nl > ] Im Auftrag von jan-mathijs schoffelen > Gesendet: Dienstag, 12. April 2011 21:18 > An: Email discussion list for the FieldTrip project > Betreff: Re: [FieldTrip] I think you solved the problem > > Dear Jan, > > I suspect that your mri, as it comes out of ft_read_mri is already > coregistered in neuromag space. After your realignment and after > replacing mri.transform with real_mri.transform, the coordinate axes > in your pic1 look strange. This I think causes the 'dropped pocket > change'. > What happens if you skip the ft_volumerealign step and call > ft_volumesegment directly on the mri (with cfg.coordsys = > 'neuromag', or, for what it's worth, without cfg.coordsys; in this > case you will be able to verify the coordinate system)? > Alternatively, if this doesn't work, could you replace mri.transform > by eye(4) prior to calling ft_volumerealign and ft_volumesegment > (both with cfg.coordsys = 'neuromag' and no further tampering with > transformation matrices?). > > Thanks > > JM > > > On Apr 12, 2011, at 8:49 PM, > wrote: > > > Dear Jan-Mathijs, > > sorry, I think I was a bit too enthusiastic when I said everything > worked out wonderfully. It worked only once. After an afternoon of > confusion I concluded that on my first try I must have misspelled > cfg.coordsys=’neuromag’ on my calls to ft_volumerealign and > ft_volumesegment. In fact, the segmentation looks really bad with > these settings. What works for me is written underneath: > > mri = ft_read_mri('….fif'); > hdr=ft_read_header('…fif'); > mri.anatomy=double(mri.anatomy); > > %this is taken from the Neuromag GUI for MRI-MEG Integration > cfg=[]; > cfg.fiducial.rpa=[136.35 142.80 31.96]; > cfg.fiducial.nas=[47.84 101.80 100.10]; > cfg.fiducial.lpa=[139.22 146.17 162.69]; > > %go from neuromag voxel to neuromag head coordinates > cfg.coordsys='neuromag'; > cfg.method='fiducial'; > real_mri=ft_volumerealign(cfg,mri); > > %taking real_mri with its coordsys field will not work, so I take mri > mri.transform=real_mri.transform; > > cfg = []; > cfg.keepintermediate = 'no'; > cfg.write = 'no'; > segmentedmri = ft_volumesegment(cfg, mri); > > > Before segmentation the function shows some kind of brain (pic 1). > When segmentation is done the segmented brain looks good (pic 2) but > the brain does not fit the helmet (pic 3). It is looking at its feet > as if it dropped some pocket change. Do you know what is going on? > > Thanks, > jan > > Von: fieldtrip-bounces at donders.ru.nl [mailto:fieldtrip-bounces at donders.ru.nl > ] Im Auftrag von jan-mathijs schoffelen > Gesendet: Dienstag, 12. April 2011 12:11 > An: Email discussion list for the FieldTrip project > Betreff: Re: [FieldTrip] I think you solved the problem > > Dear Jan, > > Apart from not being properly aligned, the segmentation looks a bit > strange to me. I suspect that not everything went well here ;o). > Could you try the following: > > specify cfg.coordsys = 'neuromag', both in your call to > ft_volumerealign and in your call to ft_volumesegment. The > cfg.coordinates for ft_volumesegment has to be removed (actually it > is a deprecated option). The idea now is that mri-structures in > fieldtrip can have a coordsys field, which allows for more > transparent use of the different head coordinate system conventions. > This takes away the need for intermediately coregistering the MRI in > 'ctf'-convention, and would also take away your need to call > headcoordinates later on. > > Best wishes, > > Jan-Mathijs > > > On Apr 12, 2011, at 11:07 AM, duesseldorf.de> wrote: > > > > Dear fieldtrip experts, > > I have two questions regarding head model creation. As noted on this > thread, the volumesegment function was updated and I tested it for > our Neuromag data. The segmentation is performed, but unfortunately > it is not aligned with the MRI in my case. Here is the code I am > using, the fieldtrip is from 9th April 2011. > > %read mri > mri = ft_read_mri(subject_files.fiff_mri); > mri.anatomy=double(mri.anatomy); > > %these are the fiducials for this subject taken from the Neuromag > GUI for coregistration > cfg=[]; > cfg.fiducial.rpa=[136.35 142.80 31.96]; > cfg.fiducial.nas=[47.84 101.80 100.10]; > cfg.fiducial.lpa=[139.22 146.17 162.69]; > > %define the head coordinate system according to CTF conventions > cfg.method='fiducial'; > real_mri=ft_volumerealign(cfg,mri); > > %segment > cfg = []; > cfg.template = '/data/apps/spm/spm8/templates/T1.nii'; > cfg.coordinates = 'ctf'; > cfg.keepintermediate = 'no'; > segmentedmri = ft_volumesegment(cfg, real_mri); > > %plot white matter > test=segmentedmri; > test.anatomy=real_mri.anatomy; > cfg=[]; > cfg.funparameter='white'; > ft_sourceplot(cfg,test); %see attached picture > > The other issue regards back-transformation from CTF to Neuromag > coordinates, which is necessary to make the head model fit the > sensors. My idea was to create an appropriate transformation matrix > like this. > > cd /net/avidya/storage/home/jan/fieldtrip-20110409/private > ctfmat=headcoordinates(nas,lpa,rpa,'ctf'); > nmmat=headcoordinates(nas,lpa,rpa,'neuromag'); > ctf_to_nm=nmmat/ctfmat; > > > And then to use it on the head model to bring it back into Neuromag > coordinates: > > %create single shell, realistic headmodel > cfg = []; > hdm = ft_prepare_singleshell(cfg,segmentedmri); > > % transformation of headmodel into Neuromag space > hdm.bnd.pnt=warp_apply(ctf_to_nm,hdm.bnd.pnt,'homogeneous'); > > Does this survive a sanity check? > > Best regards and thanks a lot, > > Jan > > > Von: fieldtrip-bounces at donders.ru.nl [mailto:fieldtrip-bounces at donders.ru.nl > ] Im Auftrag von Jen Whitman > Gesendet: Montag, 28. Februar 2011 22:32 > An: Email discussion list for the FieldTrip project > Betreff: [FieldTrip] I think you solved the problem > > I just checked, and when I re-ran my segmentation script with the > new Fieldtrip in order to use an spm8 template image, coordinates > got reversed. When I take out the calls to flipdim, they look fine > (see attached screenshots). That certainly explains the meaningless > results I was getting! > > Thanks for figuring that out, > > Jen > > On Mon, Feb 28, 2011 at 12:36 PM, jan-mathijs schoffelen > wrote: > Hi Jen, > > At first glance I have a comment on your script. You may need to > explicitly check the alignment of your segmented volume and the > original anatomy. A while a go some changes were made to > ft_volumesegment, taking away the need to do the flipdim(flipdim... > operations. I have posted this on the discussion list last January, > but you may not have noticed. > Anyway, if you now have used a recent version of FieldTrip for your > segmentation both the location of your dipole grid, and the volume > conductor model will not be adequately coregistered with the data, > which may lead to funky results to begin with. That's most likely > not related to the filetype in which the volumes are saved for later > use. > > Best wishes, > > Jan-Mathijs > > > > On Feb 28, 2011, at 8:59 PM, Jen Whitman wrote: > > > > > Hello Jan, > > When calling volumesegment, I specified 'ctf' as the coordinate > system. The function I wrote to call volumesegment and > prepare_singleshell for each subject and save the results is pasted > below, with a couple of comments added for clarity. > Over the weekend I tried specifying the coordinate system in the > call to ft_volumenormalise as 'ctf' rather than 'spm', and commented > out all the lines that said cfg.spmversion = 'spm8'; before calling > a function. However, that created worse results, as each plot > involved stripes of activation and empty voxels, suggesting that > 'ctf' was not the correct coordinate system to specify. > > Thanks for the attached script. Looking in that the comments in > that, I suspect that the solution to my problems will be to specify > my filetype as nifti_img rather than nifti. I'll let you know how > that goes. > > Jen > > ------------------------------------------------------------------------------------------------------------ > % the variable subj is simply a string consisting of a subject > number (e.g. 's05') which can be a folder name or part of a filename > function [vol mri segmentedmri > segmentedmriF]=call_volume_segment_function_spm8(subj) > cfg.spmversion = 'spm8'; > cfg.template = '/home/woodwardlab/spm8/templates/EPI.nii'; > %cfg.template='/home/common/matlab/spm2/templates/T1.mnc'; > cfg.name=[subj '_volseg']; > cfg.write='yes'; > cfg.smooth='no'; > cfg.coordinates='ctf'; > mri=read_mri([subj '/mri/' subj 'head.mri']); % made with CTF > mriConverter and mriViewer software, after fiducials were marked > segmentedmri = volumesegment(cfg, mri); > segmentedmriF = segmentedmri; > segmentedmriF.gray = flipdim(flipdim(flipdim(segmentedmriF.gray,3), > 2),1); > segmentedmriF.white = flipdim(flipdim(flipdim(segmentedmriF.white,3), > 2),1); > segmentedmriF.csf = flipdim(flipdim(flipdim(segmentedmriF.csf,3), > 2),1); > segmentedmriF.transform = mri.transform; > segmentedmriF.anatomy = mri.anatomy; > cfg = []; > cfg.spmversion = 'spm8'; > vol = prepare_singleshell(cfg, segmentedmriF); > eval(['save ' subj '/meg/mrisegmented.mat mri segmentedmri > segmentedmriF vol']) > > > > > > On Sat, Feb 26, 2011 at 5:26 AM, jan-mathijs schoffelen > wrote: > Dear Jen, > > I do not manage to reproduce your issue, when only focussing on the > ft_volumewrite and visualization part of your pipeline. See attached > script, and yet an updated version of ft_volumewrite which you need > to (hopefully) draw the same conclusion as I did. > Yet, I only now realize that your question may pertain to the entire > pipeline. It could be that something is going wrong there. > I only see now that in the part of your script of which you reported > that it gave 'good' results, you specify cfg.coordinates = 'ctf' > before calling ft_volumenormalise. I assume this is correct, because > the coordinate system your source-reconstructed data lives in, is > according to the CTF-convention, and not according to the SPM- > convention. On the other hand, the template for the spatial > normalization lives in the SPM-coordinate system. In order for the > spatial normalization to work OK, Fieldtrip tries to convert from > one coordinate system to the other (once again, this is appropriate > behaviour), before doing the actual normalization. It seems that at > least in the script you sent along, in the final (not working > version), you specified cfg.coordinates = 'spm' prior to calling > ft_volumenormalise. This is probably wrong. > Another important point that should be mentioned, is that the > coordinate systems in which the functional data and the anatomical > data live should be the same for the ft_sourceinterpolate to make > sense. In other words, if your source reconstructed images are > defined on a 3D grid of positions in CTF-space, the mri.transform of > your anatomy should describe a transformation from voxel to CTF-space. > I think you may want to revisit step by step this part of the > pipeline; I don't think the problem lies in the writing. > A final possibility of course is that Mricron is misbehaving... > > Best, > > Jan-Mathijs > > > > > > > On Feb 25, 2011, at 9:44 PM, Jen Whitman wrote: > > > > > Hi Jan, > > I tried re-running the analysis with the new script you sent me, and > the latest version of fieldtrip (since I needed ft_get_opt as well), > but the spm8 images being written are still producing flawed > results. It's the same problem as I mentioned briefly in my previous > post. I am not getting any error messages when writing these images. > Rather, my problem is that the spm8 and spm2 results from the same > data ought to be identical when viewed in mricron, but they're far > from it. When I use mricron to look at the results from the spm8- > format images, combined across participants to create a t-image, I > just get a single 'blob' spanning roughly half the brain. In > contrast, when I used spm2-format previously on the same data, the t- > image was much more meaningful; a posterior alpha power decrease in > a set of regions corresponding to the 'task-positive network' (a > network found in the results of an fMRI version of my experiment, > and widely reported in the fMRI literature). > > This failure to replicate the spm2 results when using spm8 images > from the same data leads me to suspect that something is wrong with > the coordinates for spm8 format. However, after experimenting > extensively with different cfg options I still haven't identified > the problem. If I my structural MRIs have been saved to .mri files > using CTF's MRIConverter program, which cfg options, particularly > for coordinates, template images, and filetypes, should I specify > before calling the ft_volumesegment, ft_prepare_singleshell, > ft_sourceinterpolate, ft_volumenormalise, and ft_volumewrite > functions? Or should I be calling a different set of functions now? > > Thanks again for your help, > > Jen > > On Thu, Feb 24, 2011 at 10:07 AM, Jen Whitman > wrote: > Great, thanks! > > I'll start the analysis with your new script today and will let you > know how it works out. > > Jen > > On Thu, Feb 24, 2011 at 4:44 AM, jan-mathijs schoffelen > wrote: > Dear Jen, > > I managed to reproduce your problem. The code was rather buggy and > indeed ft_volumewrite did not behave as it should have. I now fixed > it in the code and it should run fine now. Please find the updated > file attached. It will be available on our ftp-server as of tonight. > Please note that I updated the documentation, and changed the names > of some of the options a bit. If you want to save your data in > analyze-format, you should specify cfg.filetype = 'analyze_spm'. If > you specify cfg.filetype = 'nifti', it should write out a volume to > nifti-format, using SPM8. > > Best wishes, > > Jan-Mathijs > > > > > > On Feb 23, 2011, at 7:44 PM, Jen Whitman wrote: > >> >> Dear Jan, >> >> Thanks for the quick reply. Yes, I have tried it out quite a few >> times now, experimenting with different settings in the cfgs. Below >> I'll paste the code I've been using to write images - first the >> code that successfully created spm2 images that produced good >> results, then the code used for creating nifti format images from >> the same data. The comments in this second part are at this point a >> bit of a maze of cfg options I've been changing back & forth. Any >> insights/suggestions regarding how to set up my cfgs to make this >> work would be greatly appreciated. >> >> Jen >> >> >> %%%%%%%% this code generated spm2-compatible images which did work >> (producing results that made sense). >> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% >> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% >> >> sourcetemp.avg.pow = (sourcetemp.avg.pow - >> sourcePre.avg.pow) ./ sourcePre.avg.pow; >> >> cfg = []; >> cfg.downsample = 2; >> sourcetempInt = sourceinterpolate(cfg, sourcetemp , mri); >> >> % projecting the plot onto a surface... >> cfg = []; >> cfg.coordinates = 'ctf'; >> cfg.template = '/home/common/matlab/spm2/templates/T1.mnc'; >> %this template is in MNI coordinates >> sourcetempIntN = volumenormalise(cfg, sourcetempInt); >> >> filename=[subj 'run' int2str(r) 'cond' int2str(cond) '_' >> int2str(f) 'HzWin' int2str(win) 'width750ms']; >> cfg=[]; >> cfg.parameter = 'avg.pow'; % string, describing the >> functional data to be processed, e.g. 'pow', 'coh' or 'nai' >> cfg.filename = [filename '.img']; >> %'testimageoutput_alphafreq'; % filename without the extension >> cfg.filetype = 'spm'; %'analyze', 'spm', 'vmp' or 'vmr' >> cfg.coordinates = 'spm'; %'spm, 'ctf' or empty for >> interactive (default = []) >> cfg.datatype = 'double'; %'float'; %'double'; %'bit1', 'uint8', >> 'int16', 'int32', 'float' or 'double' >> >> volumewrite(cfg, sourcetempIntN) >> >> >> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% >> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% >> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% >> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% >> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% >> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% >> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% >> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% >> %%%%% this code below hasn't worked yet... >> >> % I added cfg.spmversion = 'spm8'; >> % in the cfgs for the calls to ft_prepare_leadfield and >> ft_sourceanalysis, >> % and in the call to prepare_singleshell after calling volumesegment >> >> % I've also ensured that spm8 is the only spm version in my path, >> even in >> % the fieldtrip/external folder, and ensured that spm8 is installed >> properly >> % (files compiled correctly, etc..) >> >> sourcetemp.avg.pow = (sourcetemp.avg.pow - >> sourcePre.avg.pow) ./ sourcePre.avg.pow; >> >> filename=[subj 'run' int2str(r) 'cond' int2str(cond) '_' >> int2str(f) 'Hzspm8_FIXv9_Win' int2str(win) 'width750ms.img']; >> >> cfg = []; >> % cfg.coordinates = 'spm'; % changed for version 5 >> % cfg.spmversion = 'spm8'; % changed for version 5 >> cfg.downsample = 4; >> sourcetempInt = ft_sourceinterpolate(cfg, sourcetemp , mri); >> >> >> % projecting the plot onto a surface... >> cfg = []; >> %cfg.coordinates = 'spm'; % changed for version 5 >> %cfg.coordinates = 'ctf'; % changed for version 5 >> cfg.coordinates = 'spm'; % changed back to spm for version 9 >> cfg.downsample = 4; >> %cfg.spmversion = 'spm8'; % changed for version 6 (because this >> gets specified in volumewrite) >> cfg.template = 'Hmatrix/mask.nii.nii'; % basically equivalent >> to using spm8/templates/EPI.nii, except that mask.nii (produced >> from fmri data) has the desired voxel size >> % cfg.name = [filename]; % changed for version 6 >> %cfg.write= 'yes'; % changed for version 6 (when this was set >> to 'yes' there was no subsequent call to volumewrite) >> cfg.write= 'no'; % changed for version 6 >> sourcetempIntN = ft_volumenormalise(cfg, sourcetempInt); >> >> % this whole cfg and function call added for version 6 >> cfg=[]; >> % cfg.parameter = string, describing the functional data >> to be processed, e.g. 'pow', 'coh' or 'nai' >> % cfg.filename = filename without the extension >> % cfg.filetype = 'analyze', 'spm', 'vmp' or 'vmr' >> % cfg.vmpversion = 1 or 2 (default) version of the vmp-format >> to use >> % cfg.coordinates = 'spm, 'ctf' or empty for interactive >> (default = []) >> cfg.parameter='pow'; >> cfg.filename=filename; >> cfg.filetype = 'spm'; >> cfg.spmversion = 'SPM8'; % capitalized after first error >> message from vers 6 >> % cfg.dataformat='nifti'; % added after first error message from >> vers 6 >> % commented out after 2nd error >> message from vers 6 >> %cfg.vmpversion=2; % this is a filetype, like spm, so don't >> need to specify unless cfg.filetyp='vmp' >> cfg.coordinates='spm'; >> ft_volumewrite(cfg,sourcetempIntN); >> >> >> >> >> >> >> >> On Wed, Feb 23, 2011 at 7:50 AM, jan-mathijs schoffelen > > wrote: >> Dear Jen, >> >> I notice that indeed in the documentation section of >> ft_write_volume there is a FIXME behind nifti. Yet, nifti format >> seems to be supported by ft_write_volume (at least in a recent >> version of fieldtrip). Did you try it at all (and ran into >> problems) or were you held back by the FIXME statement? Could you >> just try it out using a recent fieldtrip function? >> >> Thanks and best wishes >> >> Jan-Mathijs >> >> >> >> On Feb 23, 2011, at 2:21 AM, Jen Whitman wrote: >> >> Hello, >> >> While writing beamformed images to spm2 format in a previous >> version of fieldtrip (now lost due to a computer crash), I was able >> to get nice-looking results; networks of brain regions consistent >> with existing literature. When I try to write images from the same >> dataset and the same analysis to spm8 format, my results (t-images >> computed across subjects) end up being single clusters spanning >> large sections of the brain (e.g. a 'blob' spanning all of one >> hemisphere but not the other). Unfortunately, some aspects of my >> planned data analyses cannot be performed on spm2 images, so I have >> to find a way of writing to successfully to nifti format. >> >> I just noticed that in the comments in the ft_write_volume >> function, which I am calling via ft_volumewrite, it says 'FIXME' >> next to nifti under the list of supported dataformats. Is there by >> any chance a patch out there for writing nifti images? >> >> Thanks! >> >> _______________________________________________ >> fieldtrip mailing list >> fieldtrip at donders.ru.nl >> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip >> >> Dr. J.M. (Jan-Mathijs) Schoffelen >> Donders Institute for Brain, Cognition and Behaviour, >> Centre for Cognitive Neuroimaging, >> Radboud University Nijmegen, The Netherlands >> J.Schoffelen at donders.ru.nl >> Telephone: 0031-24-3614793 >> >> _______________________________________________ >> fieldtrip mailing list >> fieldtrip at donders.ru.nl >> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip >> >> _______________________________________________ >> fieldtrip mailing list >> fieldtrip at donders.ru.nl >> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > > > Dr. J.M. (Jan-Mathijs) Schoffelen > Donders Institute for Brain, Cognition and Behaviour, > Centre for Cognitive Neuroimaging, > Radboud University Nijmegen, The Netherlands > J.Schoffelen at donders.ru.nl > Telephone: 0031-24-3614793 > > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > > Dr. J.M. (Jan-Mathijs) Schoffelen > Donders Institute for Brain, Cognition and Behaviour, > Centre for Cognitive Neuroimaging, > Radboud University Nijmegen, The Netherlands > J.Schoffelen at donders.ru.nl > Telephone: 0031-24-3614793 > > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > > Dr. J.M. (Jan-Mathijs) Schoffelen > Donders Institute for Brain, Cognition and Behaviour, > Centre for Cognitive Neuroimaging, > Radboud University Nijmegen, The Netherlands > J.Schoffelen at donders.ru.nl > Telephone: 0031-24-3614793 > > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > > Dr. J.M. (Jan-Mathijs) Schoffelen > Donders Institute for Brain, Cognition and Behaviour, > Centre for Cognitive Neuroimaging, > Radboud University Nijmegen, The Netherlands > J.Schoffelen at donders.ru.nl > Telephone: 0031-24-3614793 > > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > > Dr. J.M. (Jan-Mathijs) Schoffelen > Donders Institute for Brain, Cognition and Behaviour, > Centre for Cognitive Neuroimaging, > Radboud University Nijmegen, The Netherlands > J.Schoffelen at donders.ru.nl > Telephone: 0031-24-3614793 > > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 -------------- next part -------------- An HTML attachment was scrubbed... URL: From inieuwenhuis at berkeley.edu Wed Apr 13 20:51:46 2011 From: inieuwenhuis at berkeley.edu (Ingrid Nieuwenhuis) Date: Wed, 13 Apr 2011 11:51:46 -0700 Subject: [FieldTrip] invalid MEX file error in clusterstat Message-ID: <4DA5F0C2.7090405@berkeley.edu> Hi I'm running ft_sourcestatistics with the following cfg: %%% cluster statistics cfg = []; cfg.parameter = 'stat'; cfg.method = 'montecarlo'; cfg.statistic = 'depsamplesT'; cfg.clusteralpha = 0.05; cfg.numrandomization = 1000; cfg.correctm = 'cluster'; cfg.design(1,1:2*Nsub) = [ones(1,Nsub) 2*ones(1,Nsub)]; cfg.design(2,1:2*Nsub) = [1:Nsub 1:Nsub]; cfg.ivar = 1; cfg.uvar = 2; cfg.alpha = 0.025; %one sided alpha!! stat_clus = ft_sourcestatistics(cfg, Rem{1:Nsub}, Rec{1:Nsub}); and get the below error, am I doing anything wrong (I must admit, I'm running a 2 year old script (which has already generated new data out of 2 year old source data without any errors: very impressive backward compatibility!), or is there just a MEX file missing? Thanks, Ingrid ??? Invalid MEX-file '/home/common/matlab/fieldtrip/external/spm8/spm_bwlabel.mexa64': /home/common/matlab/fieldtrip/external/spm8/spm_bwlabel.mexa64: undefined symbol: mxCreateNumericArray_700. Error in ==> fieldtrip/private/clusterstat at 189 [posclusobs, posnum] = spm_bwlabel(tmp, 6); % use spm_bwlabel for source data to avoid usage of image toolbox Error in ==> statistics_montecarlo at 322 [stat, cfg] = clusterstat(cfg, statrand, statobs,'issource',issource); Error in ==> fieldtrip/private/statistics_wrapper at 285 [stat, cfg] = statmethod(cfg, dat, cfg.design, 'issource',issource); Error in ==> ft_sourcestatistics at 114 [stat, cfg] = statistics_wrapper(cfg, varargin{:}); -- Ingrid Nieuwenhuis PhD Sleep and Neuroimaging Laboratory Department of Psychology University of California, Berkeley California 94720-1650 From mcoskun at mail.uh.edu Thu Apr 14 08:51:46 2011 From: mcoskun at mail.uh.edu (Mehmet-Akif Coskun) Date: Thu, 14 Apr 2011 01:51:46 -0500 Subject: [FieldTrip] dipole time course vs. virtual sensor using SVD Message-ID: <715094a06745c.4da65332@mail.uh.edu> Dear Fieldtrippers, I have been running a simple analysis for two different subject groups on the dipole time course and a virtual sensor using Singular Value Decomposition. The analysis for the two signals yielded different results. I would like to get comments on this issue. The computation of the two signals are as below: dataset: I have 248 channels x 122 time points data (averaged over a number of trials).  1) Virtual sensor using SVD: I isolated the data from 30-100ms (isolated_data: 248 x 22 timepoints) and apply SVD as [U,S,V]=svd(isolated_data). The first column of U (248x1) accounts for the largest proportion of variance and is a vector of weights assigned to the signal recorded from each of the 248 sensors. So i computed the virtual sensors as virt_sens=U(:,1)'*dataset which is a 1x122 signal. 2)Dipole time course: I fitted 1 dipole (ft_dipolefitting) to the data between 30 and 100ms, computed leadfields (ft_compute_leadfield) for the dipole and projected the pinv'ed leadfields on to the dataset to obtain the dipole time course. What may cause the differences in the results for the two approaches? What kind of mathematical assumptions does SVD and dipole fitting does? what are the weakness or the strengths of the two approaches and which one has to be trusted more? I will really appreciate any comments and suggestions. Best regards, Mehmet Coskun -------------- next part -------------- An HTML attachment was scrubbed... URL: From Jan.Hirschmann at med.uni-duesseldorf.de Thu Apr 14 09:31:51 2011 From: Jan.Hirschmann at med.uni-duesseldorf.de (Jan.Hirschmann at med.uni-duesseldorf.de) Date: Thu, 14 Apr 2011 09:31:51 +0200 Subject: [FieldTrip] I think you solved the problem In-Reply-To: <5AC469DB-D5B1-4E3C-AE21-01A53AE94A26@donders.ru.nl> References: <72E993C35FB11743B79FF9286E5B6D8B02676142@Mail2-UKD.VMED.UKD><7B5CA863-D143-404C-BCB9-805AA6E6E546@donders.ru.nl><72E993C35FB11743B79FF9286E5B6D8B02676264@Mail2-UKD.VMED.UKD><72E993C35FB11743B79FF9286E5B6D8B026763B8@Mail2-UKD.VMED.UKD> <5AC469DB-D5B1-4E3C-AE21-01A53AE94A26@donders.ru.nl> Message-ID: <72E993C35FB11743B79FF9286E5B6D8B02676493@Mail2-UKD.VMED.UKD> Dear Jan-Mathijs, sure, I will do that. I have tested one head model with ft_dipole_simulation and beamforming and it looks good (at least when I simulate two conditions and subtract sources the right location comes out). So I guess we (and maybe others) will use the new procedure now. Best, jan ________________________________ Von: fieldtrip-bounces at donders.ru.nl [mailto:fieldtrip-bounces at donders.ru.nl] Im Auftrag von jan-mathijs schoffelen Gesendet: Mittwoch, 13. April 2011 16:57 An: Email discussion list for the FieldTrip project Betreff: Re: [FieldTrip] I think you solved the problem Dear Jan, No problem. Thanks for the script. If you feel up to it, you are kindly invited to update the documentation on the fieldtrip wiki as well. If I recall correctly, at some point Hanneke added some documentation about how to create MNI-based dipole grids for neuromag data. A lot of the intermediate steps have now become obsolete and this part of the wiki can be substantially cleaned. Thanks, Jan-Mathijs On Apr 13, 2011, at 2:31 PM, wrote: Dear Jan-Mathijs, I think we solved the problem. Everthing is like you said in the first place. ft_volumerealign and ft_volumesegment should be called with cfg.coordsys='neuromag'. The only thing that was wrong is that for the voxel coordinates read from the Neuromag GUI x and y should be swapped. For anyone interested I attach a script that is meant to be easy-to-use for beginners. Thank you very much for your time! ________________________________ Von: fieldtrip-bounces at donders.ru.nl [mailto:fieldtrip-bounces at donders.ru.nl] Im Auftrag von jan-mathijs schoffelen Gesendet: Dienstag, 12. April 2011 21:18 An: Email discussion list for the FieldTrip project Betreff: Re: [FieldTrip] I think you solved the problem Dear Jan, I suspect that your mri, as it comes out of ft_read_mri is already coregistered in neuromag space. After your realignment and after replacing mri.transform with real_mri.transform, the coordinate axes in your pic1 look strange. This I think causes the 'dropped pocket change'. What happens if you skip the ft_volumerealign step and call ft_volumesegment directly on the mri (with cfg.coordsys = 'neuromag', or, for what it's worth, without cfg.coordsys; in this case you will be able to verify the coordinate system)? Alternatively, if this doesn't work, could you replace mri.transform by eye(4) prior to calling ft_volumerealign and ft_volumesegment (both with cfg.coordsys = 'neuromag' and no further tampering with transformation matrices?). Thanks JM On Apr 12, 2011, at 8:49 PM, wrote: Dear Jan-Mathijs, sorry, I think I was a bit too enthusiastic when I said everything worked out wonderfully. It worked only once. After an afternoon of confusion I concluded that on my first try I must have misspelled cfg.coordsys='neuromag' on my calls to ft_volumerealign and ft_volumesegment. In fact, the segmentation looks really bad with these settings. What works for me is written underneath: mri = ft_read_mri('....fif'); hdr=ft_read_header('...fif'); mri.anatomy=double(mri.anatomy); %this is taken from the Neuromag GUI for MRI-MEG Integration cfg=[]; cfg.fiducial.rpa=[136.35 142.80 31.96]; cfg.fiducial.nas=[47.84 101.80 100.10]; cfg.fiducial.lpa=[139.22 146.17 162.69]; %go from neuromag voxel to neuromag head coordinates cfg.coordsys='neuromag'; cfg.method='fiducial'; real_mri=ft_volumerealign(cfg,mri); %taking real_mri with its coordsys field will not work, so I take mri mri.transform=real_mri.transform; cfg = []; cfg.keepintermediate = 'no'; cfg.write = 'no'; segmentedmri = ft_volumesegment(cfg, mri); Before segmentation the function shows some kind of brain (pic 1). When segmentation is done the segmented brain looks good (pic 2) but the brain does not fit the helmet (pic 3). It is looking at its feet as if it dropped some pocket change. Do you know what is going on? Thanks, jan ________________________________ Von: fieldtrip-bounces at donders.ru.nl [mailto:fieldtrip-bounces at donders.ru.nl] Im Auftrag von jan-mathijs schoffelen Gesendet: Dienstag, 12. April 2011 12:11 An: Email discussion list for the FieldTrip project Betreff: Re: [FieldTrip] I think you solved the problem Dear Jan, Apart from not being properly aligned, the segmentation looks a bit strange to me. I suspect that not everything went well here ;o). Could you try the following: specify cfg.coordsys = 'neuromag', both in your call to ft_volumerealign and in your call to ft_volumesegment. The cfg.coordinates for ft_volumesegment has to be removed (actually it is a deprecated option). The idea now is that mri-structures in fieldtrip can have a coordsys field, which allows for more transparent use of the different head coordinate system conventions. This takes away the need for intermediately coregistering the MRI in 'ctf'-convention, and would also take away your need to call headcoordinates later on. Best wishes, Jan-Mathijs On Apr 12, 2011, at 11:07 AM, wrote: Dear fieldtrip experts, I have two questions regarding head model creation. As noted on this thread, the volumesegment function was updated and I tested it for our Neuromag data. The segmentation is performed, but unfortunately it is not aligned with the MRI in my case. Here is the code I am using, the fieldtrip is from 9th April 2011. %read mri mri = ft_read_mri(subject_files.fiff_mri); mri.anatomy=double(mri.anatomy); %these are the fiducials for this subject taken from the Neuromag GUI for coregistration cfg=[]; cfg.fiducial.rpa=[136.35 142.80 31.96]; cfg.fiducial.nas=[47.84 101.80 100.10]; cfg.fiducial.lpa=[139.22 146.17 162.69]; %define the head coordinate system according to CTF conventions cfg.method='fiducial'; real_mri=ft_volumerealign(cfg,mri); %segment cfg = []; cfg.template = '/data/apps/spm/spm8/templates/T1.nii'; cfg.coordinates = 'ctf'; cfg.keepintermediate = 'no'; segmentedmri = ft_volumesegment(cfg, real_mri); %plot white matter test=segmentedmri; test.anatomy=real_mri.anatomy; cfg=[]; cfg.funparameter='white'; ft_sourceplot(cfg,test); %see attached picture The other issue regards back-transformation from CTF to Neuromag coordinates, which is necessary to make the head model fit the sensors. My idea was to create an appropriate transformation matrix like this. cd /net/avidya/storage/home/jan/fieldtrip-20110409/private ctfmat=headcoordinates(nas,lpa,rpa,'ctf'); nmmat=headcoordinates(nas,lpa,rpa,'neuromag'); ctf_to_nm=nmmat/ctfmat; And then to use it on the head model to bring it back into Neuromag coordinates: %create single shell, realistic headmodel cfg = []; hdm = ft_prepare_singleshell(cfg,segmentedmri); % transformation of headmodel into Neuromag space hdm.bnd.pnt=warp_apply(ctf_to_nm,hdm.bnd.pnt,'homogeneous'); Does this survive a sanity check? Best regards and thanks a lot, Jan ________________________________ Von: fieldtrip-bounces at donders.ru.nl [mailto:fieldtrip-bounces at donders.ru.nl] Im Auftrag von Jen Whitman Gesendet: Montag, 28. Februar 2011 22:32 An: Email discussion list for the FieldTrip project Betreff: [FieldTrip] I think you solved the problem I just checked, and when I re-ran my segmentation script with the new Fieldtrip in order to use an spm8 template image, coordinates got reversed. When I take out the calls to flipdim, they look fine (see attached screenshots). That certainly explains the meaningless results I was getting! Thanks for figuring that out, Jen On Mon, Feb 28, 2011 at 12:36 PM, jan-mathijs schoffelen wrote: Hi Jen, At first glance I have a comment on your script. You may need to explicitly check the alignment of your segmented volume and the original anatomy. A while a go some changes were made to ft_volumesegment, taking away the need to do the flipdim(flipdim... operations. I have posted this on the discussion list last January, but you may not have noticed. Anyway, if you now have used a recent version of FieldTrip for your segmentation both the location of your dipole grid, and the volume conductor model will not be adequately coregistered with the data, which may lead to funky results to begin with. That's most likely not related to the filetype in which the volumes are saved for later use. Best wishes, Jan-Mathijs On Feb 28, 2011, at 8:59 PM, Jen Whitman wrote: Hello Jan, When calling volumesegment, I specified 'ctf' as the coordinate system. The function I wrote to call volumesegment and prepare_singleshell for each subject and save the results is pasted below, with a couple of comments added for clarity. Over the weekend I tried specifying the coordinate system in the call to ft_volumenormalise as 'ctf' rather than 'spm', and commented out all the lines that said cfg.spmversion = 'spm8'; before calling a function. However, that created worse results, as each plot involved stripes of activation and empty voxels, suggesting that 'ctf' was not the correct coordinate system to specify. Thanks for the attached script. Looking in that the comments in that, I suspect that the solution to my problems will be to specify my filetype as nifti_img rather than nifti. I'll let you know how that goes. Jen ------------------------------------------------------------------------ ------------------------------------ % the variable subj is simply a string consisting of a subject number (e.g. 's05') which can be a folder name or part of a filename function [vol mri segmentedmri segmentedmriF]=call_volume_segment_function_spm8(subj) cfg.spmversion = 'spm8'; cfg.template = '/home/woodwardlab/spm8/templates/EPI.nii'; %cfg.template='/home/common/matlab/spm2/templates/T1.mnc'; cfg.name=[subj '_volseg']; cfg.write='yes'; cfg.smooth='no'; cfg.coordinates='ctf'; mri=read_mri([subj '/mri/' subj 'head.mri']); % made with CTF mriConverter and mriViewer software, after fiducials were marked segmentedmri = volumesegment(cfg, mri); segmentedmriF = segmentedmri; segmentedmriF.gray = flipdim(flipdim(flipdim(segmentedmriF.gray,3),2),1); segmentedmriF.white = flipdim(flipdim(flipdim(segmentedmriF.white,3),2),1); segmentedmriF.csf = flipdim(flipdim(flipdim(segmentedmriF.csf,3),2),1); segmentedmriF.transform = mri.transform; segmentedmriF.anatomy = mri.anatomy; cfg = []; cfg.spmversion = 'spm8'; vol = prepare_singleshell(cfg, segmentedmriF); eval(['save ' subj '/meg/mrisegmented.mat mri segmentedmri segmentedmriF vol']) On Sat, Feb 26, 2011 at 5:26 AM, jan-mathijs schoffelen wrote: Dear Jen, I do not manage to reproduce your issue, when only focussing on the ft_volumewrite and visualization part of your pipeline. See attached script, and yet an updated version of ft_volumewrite which you need to (hopefully) draw the same conclusion as I did. Yet, I only now realize that your question may pertain to the entire pipeline. It could be that something is going wrong there. I only see now that in the part of your script of which you reported that it gave 'good' results, you specify cfg.coordinates = 'ctf' before calling ft_volumenormalise. I assume this is correct, because the coordinate system your source-reconstructed data lives in, is according to the CTF-convention, and not according to the SPM-convention. On the other hand, the template for the spatial normalization lives in the SPM-coordinate system. In order for the spatial normalization to work OK, Fieldtrip tries to convert from one coordinate system to the other (once again, this is appropriate behaviour), before doing the actual normalization. It seems that at least in the script you sent along, in the final (not working version), you specified cfg.coordinates = 'spm' prior to calling ft_volumenormalise. This is probably wrong. Another important point that should be mentioned, is that the coordinate systems in which the functional data and the anatomical data live should be the same for the ft_sourceinterpolate to make sense. In other words, if your source reconstructed images are defined on a 3D grid of positions in CTF-space, the mri.transform of your anatomy should describe a transformation from voxel to CTF-space. I think you may want to revisit step by step this part of the pipeline; I don't think the problem lies in the writing. A final possibility of course is that Mricron is misbehaving... Best, Jan-Mathijs On Feb 25, 2011, at 9:44 PM, Jen Whitman wrote: Hi Jan, I tried re-running the analysis with the new script you sent me, and the latest version of fieldtrip (since I needed ft_get_opt as well), but the spm8 images being written are still producing flawed results. It's the same problem as I mentioned briefly in my previous post. I am not getting any error messages when writing these images. Rather, my problem is that the spm8 and spm2 results from the same data ought to be identical when viewed in mricron, but they're far from it. When I use mricron to look at the results from the spm8-format images, combined across participants to create a t-image, I just get a single 'blob' spanning roughly half the brain. In contrast, when I used spm2-format previously on the same data, the t-image was much more meaningful; a posterior alpha power decrease in a set of regions corresponding to the 'task-positive network' (a network found in the results of an fMRI version of my experiment, and widely reported in the fMRI literature). This failure to replicate the spm2 results when using spm8 images from the same data leads me to suspect that something is wrong with the coordinates for spm8 format. However, after experimenting extensively with different cfg options I still haven't identified the problem. If I my structural MRIs have been saved to .mri files using CTF's MRIConverter program, which cfg options, particularly for coordinates, template images, and filetypes, should I specify before calling the ft_volumesegment, ft_prepare_singleshell, ft_sourceinterpolate, ft_volumenormalise, and ft_volumewrite functions? Or should I be calling a different set of functions now? Thanks again for your help, Jen On Thu, Feb 24, 2011 at 10:07 AM, Jen Whitman wrote: Great, thanks! I'll start the analysis with your new script today and will let you know how it works out. Jen On Thu, Feb 24, 2011 at 4:44 AM, jan-mathijs schoffelen wrote: Dear Jen, I managed to reproduce your problem. The code was rather buggy and indeed ft_volumewrite did not behave as it should have. I now fixed it in the code and it should run fine now. Please find the updated file attached. It will be available on our ftp-server as of tonight. Please note that I updated the documentation, and changed the names of some of the options a bit. If you want to save your data in analyze-format, you should specify cfg.filetype = 'analyze_spm'. If you specify cfg.filetype = 'nifti', it should write out a volume to nifti-format, using SPM8. Best wishes, Jan-Mathijs On Feb 23, 2011, at 7:44 PM, Jen Whitman wrote: Dear Jan, Thanks for the quick reply. Yes, I have tried it out quite a few times now, experimenting with different settings in the cfgs. Below I'll paste the code I've been using to write images - first the code that successfully created spm2 images that produced good results, then the code used for creating nifti format images from the same data. The comments in this second part are at this point a bit of a maze of cfg options I've been changing back & forth. Any insights/suggestions regarding how to set up my cfgs to make this work would be greatly appreciated. Jen %%%%%%%% this code generated spm2-compatible images which did work (producing results that made sense). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% sourcetemp.avg.pow = (sourcetemp.avg.pow - sourcePre.avg.pow) ./ sourcePre.avg.pow; cfg = []; cfg.downsample = 2; sourcetempInt = sourceinterpolate(cfg, sourcetemp , mri); % projecting the plot onto a surface... cfg = []; cfg.coordinates = 'ctf'; cfg.template = '/home/common/matlab/spm2/templates/T1.mnc'; %this template is in MNI coordinates sourcetempIntN = volumenormalise(cfg, sourcetempInt); filename=[subj 'run' int2str(r) 'cond' int2str(cond) '_' int2str(f) 'HzWin' int2str(win) 'width750ms']; cfg=[]; cfg.parameter = 'avg.pow'; % string, describing the functional data to be processed, e.g. 'pow', 'coh' or 'nai' cfg.filename = [filename '.img']; %'testimageoutput_alphafreq'; % filename without the extension cfg.filetype = 'spm'; %'analyze', 'spm', 'vmp' or 'vmr' cfg.coordinates = 'spm'; %'spm, 'ctf' or empty for interactive (default = []) cfg.datatype = 'double'; %'float'; %'double'; %'bit1', 'uint8', 'int16', 'int32', 'float' or 'double' volumewrite(cfg, sourcetempIntN) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%% this code below hasn't worked yet... % I added cfg.spmversion = 'spm8'; % in the cfgs for the calls to ft_prepare_leadfield and ft_sourceanalysis, % and in the call to prepare_singleshell after calling volumesegment % I've also ensured that spm8 is the only spm version in my path, even in % the fieldtrip/external folder, and ensured that spm8 is installed properly % (files compiled correctly, etc..) sourcetemp.avg.pow = (sourcetemp.avg.pow - sourcePre.avg.pow) ./ sourcePre.avg.pow; filename=[subj 'run' int2str(r) 'cond' int2str(cond) '_' int2str(f) 'Hzspm8_FIXv9_Win' int2str(win) 'width750ms.img']; cfg = []; % cfg.coordinates = 'spm'; % changed for version 5 % cfg.spmversion = 'spm8'; % changed for version 5 cfg.downsample = 4; sourcetempInt = ft_sourceinterpolate(cfg, sourcetemp , mri); % projecting the plot onto a surface... cfg = []; %cfg.coordinates = 'spm'; % changed for version 5 %cfg.coordinates = 'ctf'; % changed for version 5 cfg.coordinates = 'spm'; % changed back to spm for version 9 cfg.downsample = 4; %cfg.spmversion = 'spm8'; % changed for version 6 (because this gets specified in volumewrite) cfg.template = 'Hmatrix/mask.nii.nii'; % basically equivalent to using spm8/templates/EPI.nii, except that mask.nii (produced from fmri data) has the desired voxel size % cfg.name = [filename]; % changed for version 6 %cfg.write= 'yes'; % changed for version 6 (when this was set to 'yes' there was no subsequent call to volumewrite) cfg.write= 'no'; % changed for version 6 sourcetempIntN = ft_volumenormalise(cfg, sourcetempInt); % this whole cfg and function call added for version 6 cfg=[]; % cfg.parameter = string, describing the functional data to be processed, e.g. 'pow', 'coh' or 'nai' % cfg.filename = filename without the extension % cfg.filetype = 'analyze', 'spm', 'vmp' or 'vmr' % cfg.vmpversion = 1 or 2 (default) version of the vmp-format to use % cfg.coordinates = 'spm, 'ctf' or empty for interactive (default = []) cfg.parameter='pow'; cfg.filename=filename; cfg.filetype = 'spm'; cfg.spmversion = 'SPM8'; % capitalized after first error message from vers 6 % cfg.dataformat='nifti'; % added after first error message from vers 6 % commented out after 2nd error message from vers 6 %cfg.vmpversion=2; % this is a filetype, like spm, so don't need to specify unless cfg.filetyp='vmp' cfg.coordinates='spm'; ft_volumewrite(cfg,sourcetempIntN); On Wed, Feb 23, 2011 at 7:50 AM, jan-mathijs schoffelen wrote: Dear Jen, I notice that indeed in the documentation section of ft_write_volume there is a FIXME behind nifti. Yet, nifti format seems to be supported by ft_write_volume (at least in a recent version of fieldtrip). Did you try it at all (and ran into problems) or were you held back by the FIXME statement? Could you just try it out using a recent fieldtrip function? Thanks and best wishes Jan-Mathijs On Feb 23, 2011, at 2:21 AM, Jen Whitman wrote: Hello, While writing beamformed images to spm2 format in a previous version of fieldtrip (now lost due to a computer crash), I was able to get nice-looking results; networks of brain regions consistent with existing literature. When I try to write images from the same dataset and the same analysis to spm8 format, my results (t-images computed across subjects) end up being single clusters spanning large sections of the brain (e.g. a 'blob' spanning all of one hemisphere but not the other). Unfortunately, some aspects of my planned data analyses cannot be performed on spm2 images, so I have to find a way of writing to successfully to nifti format. I just noticed that in the comments in the ft_write_volume function, which I am calling via ft_volumewrite, it says 'FIXME' next to nifti under the list of supported dataformats. Is there by any chance a patch out there for writing nifti images? Thanks! _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 -------------- next part -------------- An HTML attachment was scrubbed... URL: From r.oostenveld at donders.ru.nl Thu Apr 14 15:04:27 2011 From: r.oostenveld at donders.ru.nl (Robert Oostenveld) Date: Thu, 14 Apr 2011 15:04:27 +0200 Subject: [FieldTrip] Fwd: BCI in 2011 and 8th BCI2000 workshop: Early Registration Deadline April 20th References: Message-ID: Dear Colleague, Please note that the early registration-deadline for the two-day symposium 'Brain-Computer Interfacing in 2011' and the 8th BCI2000 workshop is approaching fast. After April 20th, participation is subject to increased registration fees. If you are interested in interfacing with the human brain, and would like to learn about the future directions of BCI research, register now on www.bci2011.eu. Yours Sincerely, The Organizing Committee Mariska van Steensel ‘Brain-Computer Interfacing in 2011’ What is this? A two-day symposium on Brain-Computer Interfacing When and Where? Utrecht, Netherlands, May 20&21, 2011 By Whom? UMC Utrecht/Rudolf Magnus Institute and the BrainGain Consortium For Whom? Anyone interested in: Human Brain Function Interfacing with the human brain and mind Developing solutions for paralyzed patients Who speaks? Brendan Allison, Bernhard Graimann, Eberhard Fetz, Beata Jarosiewicz, Jean-Philippe Lachaux, Eric Leuthardt, Phil Kennedy, Christa Neuper, Nick Ramsey, Gerwin Schalk, Bill Shain, Andrew Schwartz, Jonathan Wolpaw For more information, please visit www.bci2011.eu The 8th BCI2000 workshop What is this? A two-day workshop on Brain-Computer Interfacing and BCI2000 When and Where? Utrecht, Netherlands, May 18&19, 2011 By Whom? UMC Utrecht/Rudolf Magnus Institute and BCI2000 For Whom? Anyone interested in: Human Brain Function Interfacing with the human brain and mind Developing solutions for paralyzed patients Program: Lectures that describe relevant technical aspects of the BCI2000 system including implementation with C ++, Matlab, Fieldtrip or Python. Hands‐on practical tutorials where participants use BCI systems to control a cursor on a computer screen and to spell words just by thinking. Exercises, in which participants build and configure a BCI with their own signal processing methods, applications, or assistive devices. For more information, please visit www.bci2011.eu > De informatie opgenomen in dit bericht kan vertrouwelijk zijn en is uitsluitend bestemd voor de geadresseerde. Indien u dit bericht onterecht ontvangt, wordt u verzocht de inhoud niet te gebruiken en de afzender direct te informeren door het bericht te retourneren. Het Universitair Medisch Centrum Utrecht is een publiekrechtelijke rechtspersoon in de zin van de W.H.W. (Wet Hoger Onderwijs en Wetenschappelijk Onderzoek) en staat geregistreerd bij de Kamer van Koophandel voor Midden-Nederland onder nr. 30244197. Denk s.v.p aan het milieu voor u deze e-mail afdrukt. This message may contain confidential information and is intended exclusively for the addressee. If you receive this message unintentionally, please do not use the contents but notify the sender immediately by return e-mail. University Medical Center Utrecht is a legal person by public law and is registered at the Chamber of Commerce for Midden-Nederland under no. 30244197. Please consider the environment before printing this e-mail. -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: attbab2f.gif Type: image/gif Size: 15792 bytes Desc: not available URL: From luoj at mail.nih.gov Thu Apr 14 18:00:52 2011 From: luoj at mail.nih.gov (Luo, Jessie (NIH/NIMH) [C]) Date: Thu, 14 Apr 2011 12:00:52 -0400 Subject: [FieldTrip] FT_READ_EVENT Message-ID: Hi experts, Can FT_READ_EVENT handle 4D data (it does not seem to be so based on the documentation)? Working on getting fieldtrip to sort out different cognitive conditions based on trigger values. Any input or suggestion on what program to use is appreciated. Thanks, Jessie From daniele.marinazzo at ugent.be Thu Apr 14 20:53:08 2011 From: daniele.marinazzo at ugent.be (Daniele Marinazzo) Date: Thu, 14 Apr 2011 20:53:08 +0200 Subject: [FieldTrip] PhD position - analysis of neuroimaging data In-Reply-To: References: Message-ID: The PhD student will be part of a research group focusing on the development and validation of new methods for the analysis of neuroimaging data. The position is financed by the Multidisciplinary Research Project "The Integrative Neuroscience of Behavioural Control", an ambitious collaboration with experimental psychologists and clinical doctors. We are looking for a highly motivated candidate, who has ideally a master degree in physics, mathematics or engineering, knows at least one programming language (matlab, R, C, etc) and has an interest for multidisciplinary research. Anyway candidates with a medical/biological background and some programming expertise are also welcome to apply. If you wish to apply for this position, please send an email with a letter explaining why you wish to do research on this theme, a CV and publication list, if any, to Daniele Marinazzo (daniele.marinazzo at ugent.be). The selections will go on until the position is filled. For more information (including the details of the project proposal), please feel free to contact Daniele Marinazzo (daniele.marinazzo at ugent.be). -- Daniele Marinazzo -- http://www.da.ugent.be Department of Data Analysis, Gent University Henri Dunantlaan 1, B-9000 Gent, Belgium -------------- next part -------------- An HTML attachment was scrubbed... URL: From luoj at mail.nih.gov Thu Apr 14 21:35:32 2011 From: luoj at mail.nih.gov (Luo, Jessie (NIH/NIMH) [C]) Date: Thu, 14 Apr 2011 15:35:32 -0400 Subject: [FieldTrip] FT_READ_EVENT In-Reply-To: <7180e5c062dbf.4da6e0c2@mail.uh.edu> References: , <7180e5c062dbf.4da6e0c2@mail.uh.edu> Message-ID: Yes you are right. Thanks Mehmet! Jessie ________________________________________ From: mcoskun at mail.uh.edu [mcoskun at mail.uh.edu] Sent: Thursday, April 14, 2011 12:55 PM To: Luo, Jessie (NIH/NIMH) [C] Subject: Re: [FieldTrip] FT_READ_EVENT Hi Jessie, I have tried this long time ago and it does handle 4D data. I just checked the .m file for ft_read_event and 4D format is implemented actually. Mehmet ----- Original Message ----- From: "Luo, Jessie (NIH/NIMH) [C]" Date: Thursday, April 14, 2011 11:09 am Subject: [FieldTrip] FT_READ_EVENT To: "fieldtrip at donders.ru.nl" > Hi experts, > > Can FT_READ_EVENT handle 4D data (it does not seem to be so > based on the documentation)? Working on getting fieldtrip to > sort out different cognitive conditions based on trigger values. > Any input or suggestion on what program to use is appreciated. > > Thanks, > Jessie > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip From jan.schoffelen at donders.ru.nl Thu Apr 14 21:46:55 2011 From: jan.schoffelen at donders.ru.nl (jan-mathijs schoffelen) Date: Thu, 14 Apr 2011 21:46:55 +0200 Subject: [FieldTrip] FT_READ_EVENT In-Reply-To: References: Message-ID: <80088F6E-2E4E-40A2-A899-C90E023FECCD@donders.ru.nl> Hi Jessie, 4D data is fully supported in FieldTrip. If the documentation suggests otherwise, that's incorrect. To get started, you can have a look here: http://fieldtrip.fcdonders.nl/tutorial/preprocessing http://fieldtrip.fcdonders.nl/walkthrough Good luck, Jan-Mathijs On Apr 14, 2011, at 6:00 PM, Luo, Jessie (NIH/NIMH) [C] wrote: > Hi experts, > > Can FT_READ_EVENT handle 4D data (it does not seem to be so based on > the documentation)? Working on getting fieldtrip to sort out > different cognitive conditions based on trigger values. Any input or > suggestion on what program to use is appreciated. > > Thanks, > Jessie > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 From luoj at mail.nih.gov Thu Apr 14 21:55:34 2011 From: luoj at mail.nih.gov (Luo, Jessie (NIH/NIMH) [C]) Date: Thu, 14 Apr 2011 15:55:34 -0400 Subject: [FieldTrip] FT_READ_EVENT In-Reply-To: <80088F6E-2E4E-40A2-A899-C90E023FECCD@donders.ru.nl> References: , <80088F6E-2E4E-40A2-A899-C90E023FECCD@donders.ru.nl> Message-ID: Thanks Jan-Mathijs! Jessie ________________________________________ From: jan-mathijs schoffelen [jan.schoffelen at donders.ru.nl] Sent: Thursday, April 14, 2011 3:46 PM To: Email discussion list for the FieldTrip project Subject: Re: [FieldTrip] FT_READ_EVENT Hi Jessie, 4D data is fully supported in FieldTrip. If the documentation suggests otherwise, that's incorrect. To get started, you can have a look here: http://fieldtrip.fcdonders.nl/tutorial/preprocessing http://fieldtrip.fcdonders.nl/walkthrough Good luck, Jan-Mathijs On Apr 14, 2011, at 6:00 PM, Luo, Jessie (NIH/NIMH) [C] wrote: > Hi experts, > > Can FT_READ_EVENT handle 4D data (it does not seem to be so based on > the documentation)? Working on getting fieldtrip to sort out > different cognitive conditions based on trigger values. Any input or > suggestion on what program to use is appreciated. > > Thanks, > Jessie > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip From mcoskun at mail.uh.edu Fri Apr 15 08:58:07 2011 From: mcoskun at mail.uh.edu (Mehmet-Akif Coskun) Date: Fri, 15 Apr 2011 01:58:07 -0500 Subject: [FieldTrip] dipole waveform scale Message-ID: <7260941e607dc.4da7a62f@mail.uh.edu> Dear Fieldtrippers, The input data scaling for averaged data is in Tesla, but i wonder what is the units and the scale for dipole waveforms. When i checked the meg_leadfield1 m file, at the end leadfields are multiplied by 1e-7. Where this factor comes from? Thanks Mehmet Hope that helps. I'm thinking that if your gradiometer data scaling is in meters (check your grad structure) and the input data scaling to the last dot operation is in fT, then your output scale will be A-m (1e-9), but you might want to check since I didn't confirm that. I think by default the fieldtrip MEG data are in units of T so you might need to scale your input data accordingly to get your desired output scale. But then, I'm assuming MEG gradiometer data input, so if you have something else, check your function call to ft_compute_leadfield and adjust your scaling accordingly -------------- next part -------------- An HTML attachment was scrubbed... URL: From Hanneke.vanDijk at med.uni-duesseldorf.de Fri Apr 15 11:34:20 2011 From: Hanneke.vanDijk at med.uni-duesseldorf.de (Hanneke van Dijk) Date: Fri, 15 Apr 2011 11:34:20 +0200 Subject: [FieldTrip] I think you solved the problem In-Reply-To: <72E993C35FB11743B79FF9286E5B6D8B02676493@Mail2-UKD.VMED.UKD> References: <72E993C35FB11743B79FF9286E5B6D8B02676142@Mail2-UKD.VMED.UKD> <7B5CA863-D143-404C-BCB9-805AA6E6E546@donders.ru.nl> <72E993C35FB11743B79FF9286E5B6D8B02676264@Mail2-UKD.VMED.UKD> <72E993C35FB11743B79FF9286E5B6D8B026763B8@Mail2-UKD.VMED.UKD> <5AC469DB-D5B1-4E3C-AE21-01A53AE94A26@donders.ru.nl> <72E993C35FB11743B79FF9286E5B6D8B02676493@Mail2-UKD.VMED.UKD> Message-ID: Dear Jan and Jan-Mathijs, Thanks for working on this problem! I'm testing it for data recorded with the 'old' neuromag 122 system. I'm using the script that Jan attached to a previous e-mail, and the fieldtrip version that was released yesterday. The first question that I have is: What to do if you don't have fiducial information from the neuromag software? I could use ft_volume_realign with cfg.method = 'interactive' and point the fiducials out and swap the y and x axes. But in what coordinate system am I then, and in what coordinate system should I move on? second, My 'vol' , headmodel, seems to end up in a factor 10 (or more(?)) smaller unit then the grid and grad. You can't even see it in the headmodelplot (it is a small dot somewhere in the middle). I don't know what happened there. third, If you look at the picture I attached the grid is not in the centre of the helmet (pic1 from the top down), and very low (pic2 looking from the left). I don't know how to solve that. I at least think the subject was not in the helmet that way! Groetjes Hanneke -------------------------------------------------- Dr. Hanneke van Dijk Institut für Klinische Neurowissenschaften und Medizinische Psychologie Gebäude-Nr.: 23.02 Ebene: 03 Zimmer-Nr.: 47 Tel.: +49 211-81-13074 Mail : hanneke.vandijk at med.uni-duesseldorf.de http://www.uniklinik-duesseldorf.de/deutsch/unternehmen/institute/KlinNeurowiss/Team/HannekevanDijk/page.html On Thu, Apr 14, 2011 at 9:31 AM, wrote: > Dear Jan-Mathijs, > > > > sure, I will do that. I have tested one head model with > ft_dipole_simulation and beamforming and it looks good (at least when I > simulate two conditions and subtract sources the right location comes out). > So I guess we (and maybe others) will use the new procedure now. > > > > Best, > > jan > > > ------------------------------ > > *Von:* fieldtrip-bounces at donders.ru.nl [mailto: > fieldtrip-bounces at donders.ru.nl] *Im Auftrag von *jan-mathijs schoffelen > *Gesendet:* Mittwoch, 13. April 2011 16:57 > *An:* Email discussion list for the FieldTrip project > *Betreff:* Re: [FieldTrip] I think you solved the problem > > > > Dear Jan, > > > > No problem. Thanks for the script. If you feel up to it, you are kindly > invited to update the documentation on the fieldtrip wiki as well. If I > recall correctly, at some point Hanneke added some documentation about how > to create MNI-based dipole grids for neuromag data. A lot of the > intermediate steps have now become obsolete and this part of the wiki can be > substantially cleaned. > > > > Thanks, > > > > Jan-Mathijs > > > > > > On Apr 13, 2011, at 2:31 PM, < > Jan.Hirschmann at med.uni-duesseldorf.de> wrote: > > > > Dear Jan-Mathijs, > > > > I think we solved the problem. Everthing is like you said in the first > place. ft_volumerealign and ft_volumesegment should be called with > cfg.coordsys=’neuromag’. The only thing that was wrong is that for the voxel > coordinates read from the Neuromag GUI x and y should be swapped. For anyone > interested I attach a script that is meant to be easy-to-use for beginners. > > > > Thank you very much for your time! > ------------------------------ > > *Von:* fieldtrip-bounces at donders.ru.nl [ > mailto:fieldtrip-bounces at donders.ru.nl ] > *Im Auftrag von *jan-mathijs schoffelen > *Gesendet:* Dienstag, 12. April 2011 21:18 > *An:* Email discussion list for the FieldTrip project > *Betreff:* Re: [FieldTrip] I think you solved the problem > > > > Dear Jan, > > > > I suspect that your mri, as it comes out of ft_read_mri is already > coregistered in neuromag space. After your realignment and after replacing > mri.transform with real_mri.transform, the coordinate axes in your pic1 look > strange. This I think causes the 'dropped pocket change'. > > What happens if you skip the ft_volumerealign step and call > ft_volumesegment directly on the mri (with cfg.coordsys = 'neuromag', or, > for what it's worth, without cfg.coordsys; in this case you will be able to > verify the coordinate system)? > > Alternatively, if this doesn't work, could you replace mri.transform by > eye(4) prior to calling ft_volumerealign and ft_volumesegment (both with > cfg.coordsys = 'neuromag' and no further tampering with transformation > matrices?). > > > > Thanks > > > > JM > > > > > > On Apr 12, 2011, at 8:49 PM, < > Jan.Hirschmann at med.uni-duesseldorf.de> wrote: > > > > > Dear Jan-Mathijs, > > > > sorry, I think I was a bit too enthusiastic when I said everything worked > out wonderfully. It worked only once. After an afternoon of confusion I > concluded that on my first try I must have misspelled > cfg.coordsys=’neuromag’ on my calls to ft_volumerealign and > ft_volumesegment. In fact, the segmentation looks really bad with these > settings. What works for me is written underneath: > > > > mri = ft_read_mri('….fif'); > > hdr=ft_read_header('…fif'); > > mri.anatomy=double(mri.anatomy); > > > > %this is taken from the Neuromag GUI for MRI-MEG Integration > > cfg=[]; > > cfg.fiducial.rpa=[136.35 142.80 31.96]; > > cfg.fiducial.nas=[47.84 101.80 100.10]; > > cfg.fiducial.lpa=[139.22 146.17 162.69]; > > > > %go from neuromag voxel to neuromag head coordinates > > cfg.coordsys='neuromag'; > > cfg.method='fiducial'; > > real_mri=ft_volumerealign(cfg,mri); > > > > %taking real_mri with its coordsys field will not work, so I take mri > > mri.transform=real_mri.transform; > > > > cfg = []; > > cfg.keepintermediate = 'no'; > > cfg.write = 'no'; > > segmentedmri = ft_volumesegment(cfg, mri); > > > > > > Before segmentation the function shows some kind of brain (pic 1). When > segmentation is done the segmented brain looks good (pic 2) but the brain > does not fit the helmet (pic 3). It is looking at its feet as if it dropped > some pocket change. Do you know what is going on? > > > > Thanks, > > jan > > > ------------------------------ > > *Von:* fieldtrip-bounces at donders.ru.nl [ > mailto:fieldtrip-bounces at donders.ru.nl ] > *Im Auftrag von *jan-mathijs schoffelen > *Gesendet:* Dienstag, 12. April 2011 12:11 > *An:* Email discussion list for the FieldTrip project > *Betreff:* Re: [FieldTrip] I think you solved the problem > > > > Dear Jan, > > > > Apart from not being properly aligned, the segmentation looks a bit strange > to me. I suspect that not everything went well here ;o). > > Could you try the following: > > > > specify cfg.coordsys = 'neuromag', both in your call to ft_volumerealign > and in your call to ft_volumesegment. The cfg.coordinates for > ft_volumesegment has to be removed (actually it is a deprecated option). The > idea now is that mri-structures in fieldtrip can have a coordsys field, > which allows for more transparent use of the different head coordinate > system conventions. This takes away the need for intermediately > coregistering the MRI in 'ctf'-convention, and would also take away your > need to call headcoordinates later on. > > > > Best wishes, > > > > Jan-Mathijs > > > > > > On Apr 12, 2011, at 11:07 AM, < > Jan.Hirschmann at med.uni-duesseldorf.de> wrote: > > > > > > Dear fieldtrip experts, > > > > I have two questions regarding head model creation. As noted on this > thread, the volumesegment function was updated and I tested it for our > Neuromag data. The segmentation is performed, but unfortunately it is not > aligned with the MRI in my case. Here is the code I am using, the fieldtrip > is from 9th April 2011. > > > > %read mri > > mri = ft_read_mri(subject_files.fiff_mri); > > mri.anatomy=double(mri.anatomy); > > > > %these are the fiducials for this subject taken from the Neuromag GUI for > coregistration > > cfg=[]; > > cfg.fiducial.rpa=[136.35 142.80 31.96]; > > cfg.fiducial.nas=[47.84 101.80 100.10]; > > cfg.fiducial.lpa=[139.22 146.17 162.69]; > > > > %define the head coordinate system according to CTF conventions > > cfg.method='fiducial'; > > real_mri=ft_volumerealign(cfg,mri); > > > > %segment > > cfg = []; > > cfg.template = '/data/apps/spm/spm8/templates/T1.nii'; > > cfg.coordinates = 'ctf'; > > cfg.keepintermediate = 'no'; > > segmentedmri = ft_volumesegment(cfg, real_mri); > > > > %plot white matter > > test=segmentedmri; > > test.anatomy=real_mri.anatomy; > > cfg=[]; > > cfg.funparameter='white'; > > ft_sourceplot(cfg,test); %see attached picture > > > > The other issue regards back-transformation from CTF to Neuromag > coordinates, which is necessary to make the head model fit the sensors. My > idea was to create an appropriate transformation matrix like this. > > > > cd /net/avidya/storage/home/jan/fieldtrip-20110409/private > > ctfmat=headcoordinates(nas,lpa,rpa,'ctf'); > > nmmat=headcoordinates(nas,lpa,rpa,'neuromag'); > > ctf_to_nm=nmmat/ctfmat; > > > > > > And then to use it on the head model to bring it back into Neuromag > coordinates: > > > > %create single shell, realistic headmodel > > cfg = []; > > hdm = ft_prepare_singleshell(cfg,segmentedmri); > > > > % transformation of headmodel into Neuromag space > > hdm.bnd.pnt=warp_apply(ctf_to_nm,hdm.bnd.pnt,'homogeneous'); > > > > Does this survive a sanity check? > > > > Best regards and thanks a lot, > > > > Jan > > > > > ------------------------------ > > *Von:* fieldtrip-bounces at donders.ru.nl [ > mailto:fieldtrip-bounces at donders.ru.nl ] > *Im Auftrag von *Jen Whitman > *Gesendet:* Montag, 28. Februar 2011 22:32 > *An:* Email discussion list for the FieldTrip project > *Betreff:* [FieldTrip] I think you solved the problem > > > > I just checked, and when I re-ran my segmentation script with the new > Fieldtrip in order to use an spm8 template image, coordinates got reversed. > When I take out the calls to flipdim, they look fine (see attached > screenshots). That certainly explains the meaningless results I was getting! > > Thanks for figuring that out, > > Jen > > On Mon, Feb 28, 2011 at 12:36 PM, jan-mathijs schoffelen < > jan.schoffelen at donders.ru.nl> wrote: > > Hi Jen, > > > > At first glance I have a comment on your script. You may need to explicitly > check the alignment of your segmented volume and the original anatomy. A > while a go some changes were made to ft_volumesegment, taking away the need > to do the flipdim(flipdim... operations. I have posted this on the > discussion list last January, but you may not have noticed. > > Anyway, if you now have used a recent version of FieldTrip for your > segmentation both the location of your dipole grid, and the volume conductor > model will not be adequately coregistered with the data, which may lead to > funky results to begin with. That's most likely not related to the filetype > in which the volumes are saved for later use. > > > > Best wishes, > > > > Jan-Mathijs > > > > > > > > On Feb 28, 2011, at 8:59 PM, Jen Whitman wrote: > > > > > > > Hello Jan, > > When calling volumesegment, I specified 'ctf' as the coordinate system. The > function I wrote to call volumesegment and prepare_singleshell for each > subject and save the results is pasted below, with a couple of comments > added for clarity. > Over the weekend I tried specifying the coordinate system in the call to > ft_volumenormalise as 'ctf' rather than 'spm', and commented out all the > lines that said cfg.spmversion = 'spm8'; before calling a function. However, > that created worse results, as each plot involved stripes of activation and > empty voxels, suggesting that 'ctf' was not the correct coordinate system to > specify. > > Thanks for the attached script. Looking in that the comments in that, I > suspect that the solution to my problems will be to specify my filetype as > nifti_img rather than nifti. I'll let you know how that goes. > > Jen > > > ------------------------------------------------------------------------------------------------------------ > % the variable subj is simply a string consisting of a subject number (e.g. > 's05') which can be a folder name or part of a filename > function [vol mri segmentedmri > segmentedmriF]=call_volume_segment_function_spm8(subj) > cfg.spmversion = 'spm8'; > cfg.template = '/home/woodwardlab/spm8/templates/EPI.nii'; > %cfg.template='/home/common/matlab/spm2/templates/T1.mnc'; > cfg.name=[subj '_volseg']; > cfg.write='yes'; > cfg.smooth='no'; > cfg.coordinates='ctf'; > mri=read_mri([subj '/mri/' subj 'head.mri']); % made with CTF mriConverter > and mriViewer software, after fiducials were marked > segmentedmri = volumesegment(cfg, mri); > segmentedmriF = segmentedmri; > segmentedmriF.gray = flipdim(flipdim(flipdim(segmentedmriF.gray,3),2),1); > segmentedmriF.white = flipdim(flipdim(flipdim(segmentedmriF.white,3),2),1); > segmentedmriF.csf = flipdim(flipdim(flipdim(segmentedmriF.csf,3),2),1); > segmentedmriF.transform = mri.transform; > segmentedmriF.anatomy = mri.anatomy; > cfg = []; > cfg.spmversion = 'spm8'; > vol = prepare_singleshell(cfg, segmentedmriF); > eval(['save ' subj '/meg/mrisegmented.mat mri segmentedmri segmentedmriF > vol']) > > > > > > On Sat, Feb 26, 2011 at 5:26 AM, jan-mathijs schoffelen < > jan.schoffelen at donders.ru.nl> wrote: > > Dear Jen, > > > > I do not manage to reproduce your issue, when only focussing on the > ft_volumewrite and visualization part of your pipeline. See attached script, > and yet an updated version of ft_volumewrite which you need to (hopefully) > draw the same conclusion as I did. > > Yet, I only now realize that your question may pertain to the entire > pipeline. It could be that something is going wrong there. > > I only see now that in the part of your script of which you reported that > it gave 'good' results, you specify cfg.coordinates = 'ctf' before calling > ft_volumenormalise. I assume this is correct, because the coordinate system > your source-reconstructed data lives in, is according to the CTF-convention, > and not according to the SPM-convention. On the other hand, the template for > the spatial normalization lives in the SPM-coordinate system. In order for > the spatial normalization to work OK, Fieldtrip tries to convert from one > coordinate system to the other (once again, this is appropriate behaviour), > before doing the actual normalization. It seems that at least in the script > you sent along, in the final (not working version), you specified > cfg.coordinates = 'spm' prior to calling ft_volumenormalise. This is > probably wrong. > > Another important point that should be mentioned, is that the coordinate > systems in which the functional data and the anatomical data live should be > the same for the ft_sourceinterpolate to make sense. In other words, if your > source reconstructed images are defined on a 3D grid of positions in > CTF-space, the mri.transform of your anatomy should describe a > transformation from voxel to CTF-space. > > I think you may want to revisit step by step this part of the pipeline; I > don't think the problem lies in the writing. > > A final possibility of course is that Mricron is misbehaving... > > > > Best, > > > > Jan-Mathijs > > > > > > > > > > > > > > On Feb 25, 2011, at 9:44 PM, Jen Whitman wrote: > > > > > > > Hi Jan, > > I tried re-running the analysis with the new script you sent me, and the > latest version of fieldtrip (since I needed ft_get_opt as well), but the > spm8 images being written are still producing flawed results. It's the same > problem as I mentioned briefly in my previous post. I am not getting any > error messages when writing these images. Rather, my problem is that the > spm8 and spm2 results from the same data ought to be identical when viewed > in mricron, but they're far from it. When I use mricron to look at the > results from the spm8-format images, combined across participants to create > a t-image, I just get a single 'blob' spanning roughly half the brain. In > contrast, when I used spm2-format previously on the same data, the t-image > was much more meaningful; a posterior alpha power decrease in a set of > regions corresponding to the 'task-positive network' (a network found in the > results of an fMRI version of my experiment, and widely reported in the fMRI > literature). > > This failure to replicate the spm2 results when using spm8 images from the > same data leads me to suspect that something is wrong with the coordinates > for spm8 format. However, after experimenting extensively with different cfg > options I still haven't identified the problem. If I my structural MRIs have > been saved to .mri files using CTF's MRIConverter program, which cfg > options, particularly for coordinates, template images, and filetypes, > should I specify before calling the ft_volumesegment, > ft_prepare_singleshell, ft_sourceinterpolate, ft_volumenormalise, and > ft_volumewrite functions? Or should I be calling a different set of > functions now? > > Thanks again for your help, > > Jen > > On Thu, Feb 24, 2011 at 10:07 AM, Jen Whitman > wrote: > > Great, thanks! > > I'll start the analysis with your new script today and will let you know > how it works out. > > Jen > > On Thu, Feb 24, 2011 at 4:44 AM, jan-mathijs schoffelen < > jan.schoffelen at donders.ru.nl> wrote: > > Dear Jen, > > > > I managed to reproduce your problem. The code was rather buggy and indeed > ft_volumewrite did not behave as it should have. I now fixed it in the code > and it should run fine now. Please find the updated file attached. It will > be available on our ftp-server as of tonight. Please note that I updated the > documentation, and changed the names of some of the options a bit. If you > want to save your data in analyze-format, you should specify cfg.filetype = > 'analyze_spm'. If you specify cfg.filetype = 'nifti', it should write out a > volume to nifti-format, using SPM8. > > > > Best wishes, > > > > Jan-Mathijs > > > > > > > > > > > > On Feb 23, 2011, at 7:44 PM, Jen Whitman wrote: > > > > > Dear Jan, > > Thanks for the quick reply. Yes, I have tried it out quite a few times now, > experimenting with different settings in the cfgs. Below I'll paste the code > I've been using to write images - first the code that successfully created > spm2 images that produced good results, then the code used for creating > nifti format images from the same data. The comments in this second part are > at this point a bit of a maze of cfg options I've been changing back & > forth. Any insights/suggestions regarding how to set up my cfgs to make this > work would be greatly appreciated. > > Jen > > > %%%%%%%% this code generated spm2-compatible images which did work > (producing results that made sense). > > %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% > > sourcetemp.avg.pow = (sourcetemp.avg.pow - sourcePre.avg.pow) ./ > sourcePre.avg.pow; > > cfg = []; > cfg.downsample = 2; > sourcetempInt = sourceinterpolate(cfg, sourcetemp , mri); > > % projecting the plot onto a surface... > cfg = []; > cfg.coordinates = 'ctf'; > cfg.template = '/home/common/matlab/spm2/templates/T1.mnc'; %this > template is in MNI coordinates > sourcetempIntN = volumenormalise(cfg, sourcetempInt); > > filename=[subj 'run' int2str(r) 'cond' int2str(cond) '_' int2str(f) > 'HzWin' int2str(win) 'width750ms']; > cfg=[]; > cfg.parameter = 'avg.pow'; % string, describing the functional data > to be processed, e.g. 'pow', 'coh' or 'nai' > cfg.filename = [filename '.img']; %'testimageoutput_alphafreq'; % > filename without the extension > cfg.filetype = 'spm'; %'analyze', 'spm', 'vmp' or 'vmr' > cfg.coordinates = 'spm'; %'spm, 'ctf' or empty for interactive > (default = []) > cfg.datatype = 'double'; %'float'; %'double'; %'bit1', 'uint8', > 'int16', 'int32', 'float' or 'double' > > volumewrite(cfg, sourcetempIntN) > > > > %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% > > %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% > > %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% > > %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% > %%%%% this code below hasn't worked yet... > > % I added cfg.spmversion = 'spm8'; > % in the cfgs for the calls to ft_prepare_leadfield and ft_sourceanalysis, > % and in the call to prepare_singleshell after calling volumesegment > > % I've also ensured that spm8 is the only spm version in my path, even in > % the fieldtrip/external folder, and ensured that spm8 is installed > properly > % (files compiled correctly, etc..) > > sourcetemp.avg.pow = (sourcetemp.avg.pow - sourcePre.avg.pow) ./ > sourcePre.avg.pow; > > filename=[subj 'run' int2str(r) 'cond' int2str(cond) '_' int2str(f) > 'Hzspm8_FIXv9_Win' int2str(win) 'width750ms.img']; > > cfg = []; > % cfg.coordinates = 'spm'; % changed for version 5 > % cfg.spmversion = 'spm8'; % changed for version 5 > cfg.downsample = 4; > sourcetempInt = ft_sourceinterpolate(cfg, sourcetemp , mri); > > > % projecting the plot onto a surface... > cfg = []; > %cfg.coordinates = 'spm'; % changed for version 5 > %cfg.coordinates = 'ctf'; % changed for version 5 > cfg.coordinates = 'spm'; % changed back to spm for version 9 > cfg.downsample = 4; > %cfg.spmversion = 'spm8'; % changed for version 6 (because this gets > specified in volumewrite) > cfg.template = 'Hmatrix/mask.nii.nii'; % basically equivalent to using > spm8/templates/EPI.nii, except that mask.nii (produced from fmri data) has > the desired voxel size > % cfg.name = [filename]; % changed for version 6 > %cfg.write= 'yes'; % changed for version 6 (when this was set to 'yes' > there was no subsequent call to volumewrite) > cfg.write= 'no'; % changed for version 6 > sourcetempIntN = ft_volumenormalise(cfg, sourcetempInt); > > % this whole cfg and function call added for version 6 > cfg=[]; > % cfg.parameter = string, describing the functional data to be > processed, e.g. 'pow', 'coh' or 'nai' > % cfg.filename = filename without the extension > % cfg.filetype = 'analyze', 'spm', 'vmp' or 'vmr' > % cfg.vmpversion = 1 or 2 (default) version of the vmp-format to use > % cfg.coordinates = 'spm, 'ctf' or empty for interactive (default = []) > cfg.parameter='pow'; > cfg.filename=filename; > cfg.filetype = 'spm'; > cfg.spmversion = 'SPM8'; % capitalized after first error message from > vers 6 > % cfg.dataformat='nifti'; % added after first error message from vers 6 > % commented out after 2nd error message > from vers 6 > %cfg.vmpversion=2; % this is a filetype, like spm, so don't need to > specify unless cfg.filetyp='vmp' > cfg.coordinates='spm'; > ft_volumewrite(cfg,sourcetempIntN); > > > > > > > > On Wed, Feb 23, 2011 at 7:50 AM, jan-mathijs schoffelen < > jan.schoffelen at donders.ru.nl> wrote: > > Dear Jen, > > I notice that indeed in the documentation section of ft_write_volume there > is a FIXME behind nifti. Yet, nifti format seems to be supported by > ft_write_volume (at least in a recent version of fieldtrip). Did you try it > at all (and ran into problems) or were you held back by the FIXME statement? > Could you just try it out using a recent fieldtrip function? > > Thanks and best wishes > > Jan-Mathijs > > > > > On Feb 23, 2011, at 2:21 AM, Jen Whitman wrote: > > Hello, > > While writing beamformed images to spm2 format in a previous version of > fieldtrip (now lost due to a computer crash), I was able to get nice-looking > results; networks of brain regions consistent with existing literature. When > I try to write images from the same dataset and the same analysis to spm8 > format, my results (t-images computed across subjects) end up being single > clusters spanning large sections of the brain (e.g. a 'blob' spanning all of > one hemisphere but not the other). Unfortunately, some aspects of my planned > data analyses cannot be performed on spm2 images, so I have to find a way of > writing to successfully to nifti format. > > I just noticed that in the comments in the ft_write_volume function, which > I am calling via ft_volumewrite, it says 'FIXME' next to nifti under the > list of supported dataformats. Is there by any chance a patch out there for > writing nifti images? > > Thanks! > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > > > Dr. J.M. (Jan-Mathijs) Schoffelen > Donders Institute for Brain, Cognition and Behaviour, > Centre for Cognitive Neuroimaging, > Radboud University Nijmegen, The Netherlands > J.Schoffelen at donders.ru.nl > Telephone: 0031-24-3614793 > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > > > > Dr. J.M. (Jan-Mathijs) Schoffelen > > Donders Institute for Brain, Cognition and Behaviour, > Centre for Cognitive Neuroimaging, > Radboud University Nijmegen, The Netherlands > > J.Schoffelen at donders.ru.nl > > Telephone: 0031-24-3614793 > > > > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > > > > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > > > > Dr. J.M. (Jan-Mathijs) Schoffelen > > Donders Institute for Brain, Cognition and Behaviour, > Centre for Cognitive Neuroimaging, > Radboud University Nijmegen, The Netherlands > > J.Schoffelen at donders.ru.nl > > Telephone: 0031-24-3614793 > > > > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > > > > Dr. J.M. (Jan-Mathijs) Schoffelen > > Donders Institute for Brain, Cognition and Behaviour, > Centre for Cognitive Neuroimaging, > Radboud University Nijmegen, The Netherlands > > J.Schoffelen at donders.ru.nl > > Telephone: 0031-24-3614793 > > > > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > > > > > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > > > > Dr. J.M. (Jan-Mathijs) Schoffelen > > Donders Institute for Brain, Cognition and Behaviour, > Centre for Cognitive Neuroimaging, > Radboud University Nijmegen, The Netherlands > > J.Schoffelen at donders.ru.nl > > Telephone: 0031-24-3614793 > > > > > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > > > > Dr. J.M. (Jan-Mathijs) Schoffelen > > Donders Institute for Brain, Cognition and Behaviour, > Centre for Cognitive Neuroimaging, > Radboud University Nijmegen, The Netherlands > > J.Schoffelen at donders.ru.nl > > Telephone: 0031-24-3614793 > > > > > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > > > > Dr. J.M. (Jan-Mathijs) Schoffelen > > Donders Institute for Brain, Cognition and Behaviour, > Centre for Cognitive Neuroimaging, > Radboud University Nijmegen, The Netherlands > > J.Schoffelen at donders.ru.nl > > Telephone: 0031-24-3614793 > > > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: pic1.jpg Type: image/jpeg Size: 22308 bytes Desc: not available URL: From Hanneke.vanDijk at med.uni-duesseldorf.de Fri Apr 15 12:38:56 2011 From: Hanneke.vanDijk at med.uni-duesseldorf.de (Hanneke van Dijk) Date: Fri, 15 Apr 2011 12:38:56 +0200 Subject: [FieldTrip] I think you solved the problem In-Reply-To: References: <72E993C35FB11743B79FF9286E5B6D8B02676142@Mail2-UKD.VMED.UKD> <7B5CA863-D143-404C-BCB9-805AA6E6E546@donders.ru.nl> <72E993C35FB11743B79FF9286E5B6D8B02676264@Mail2-UKD.VMED.UKD> <72E993C35FB11743B79FF9286E5B6D8B026763B8@Mail2-UKD.VMED.UKD> <5AC469DB-D5B1-4E3C-AE21-01A53AE94A26@donders.ru.nl> <72E993C35FB11743B79FF9286E5B6D8B02676493@Mail2-UKD.VMED.UKD> Message-ID: sorry, forgot to attach pic2 On Fri, Apr 15, 2011 at 11:34 AM, Hanneke van Dijk < Hanneke.vanDijk at med.uni-duesseldorf.de> wrote: > Dear Jan and Jan-Mathijs, > > Thanks for working on this problem! I'm testing it for data recorded with > the 'old' neuromag 122 system. I'm using the script that Jan attached to a > previous e-mail, and the fieldtrip version that was released yesterday. The > first question that I have is: > > What to do if you don't have fiducial information from the neuromag > software? I could use ft_volume_realign with cfg.method = 'interactive' and > point the fiducials out and swap the y and x axes. But in what coordinate > system am I then, and in what coordinate system should I move on? > > second, > > My 'vol' , headmodel, seems to end up in a factor 10 (or more(?)) smaller > unit then the grid and grad. You can't even see it in the headmodelplot (it > is a small dot somewhere in the middle). I don't know what happened there. > > third, > > If you look at the picture I attached the grid is not in the centre of the > helmet (pic1 from the top down), and very low (pic2 looking from the left). > I don't know how to solve that. I at least think the subject was not in the > helmet that way! > > Groetjes Hanneke > > -------------------------------------------------- > Dr. Hanneke van Dijk > Institut für Klinische Neurowissenschaften und Medizinische Psychologie > Gebäude-Nr.: 23.02 > Ebene: 03 Zimmer-Nr.: 47 > Tel.: +49 211-81-13074 > Mail : hanneke.vandijk at med.uni-duesseldorf.de > > http://www.uniklinik-duesseldorf.de/deutsch/unternehmen/institute/KlinNeurowiss/Team/HannekevanDijk/page.html > > > On Thu, Apr 14, 2011 at 9:31 AM, wrote: > >> Dear Jan-Mathijs, >> >> >> >> sure, I will do that. I have tested one head model with >> ft_dipole_simulation and beamforming and it looks good (at least when I >> simulate two conditions and subtract sources the right location comes out). >> So I guess we (and maybe others) will use the new procedure now. >> >> >> >> Best, >> >> jan >> >> >> ------------------------------ >> >> *Von:* fieldtrip-bounces at donders.ru.nl [mailto: >> fieldtrip-bounces at donders.ru.nl] *Im Auftrag von *jan-mathijs schoffelen >> *Gesendet:* Mittwoch, 13. April 2011 16:57 >> *An:* Email discussion list for the FieldTrip project >> *Betreff:* Re: [FieldTrip] I think you solved the problem >> >> >> >> Dear Jan, >> >> >> >> No problem. Thanks for the script. If you feel up to it, you are kindly >> invited to update the documentation on the fieldtrip wiki as well. If I >> recall correctly, at some point Hanneke added some documentation about how >> to create MNI-based dipole grids for neuromag data. A lot of the >> intermediate steps have now become obsolete and this part of the wiki can be >> substantially cleaned. >> >> >> >> Thanks, >> >> >> >> Jan-Mathijs >> >> >> >> >> >> On Apr 13, 2011, at 2:31 PM, < >> Jan.Hirschmann at med.uni-duesseldorf.de> wrote: >> >> >> >> Dear Jan-Mathijs, >> >> >> >> I think we solved the problem. Everthing is like you said in the first >> place. ft_volumerealign and ft_volumesegment should be called with >> cfg.coordsys=’neuromag’. The only thing that was wrong is that for the voxel >> coordinates read from the Neuromag GUI x and y should be swapped. For anyone >> interested I attach a script that is meant to be easy-to-use for beginners. >> >> >> >> Thank you very much for your time! >> ------------------------------ >> >> *Von:* fieldtrip-bounces at donders.ru.nl [ >> mailto:fieldtrip-bounces at donders.ru.nl ] >> *Im Auftrag von *jan-mathijs schoffelen >> *Gesendet:* Dienstag, 12. April 2011 21:18 >> *An:* Email discussion list for the FieldTrip project >> *Betreff:* Re: [FieldTrip] I think you solved the problem >> >> >> >> Dear Jan, >> >> >> >> I suspect that your mri, as it comes out of ft_read_mri is already >> coregistered in neuromag space. After your realignment and after replacing >> mri.transform with real_mri.transform, the coordinate axes in your pic1 look >> strange. This I think causes the 'dropped pocket change'. >> >> What happens if you skip the ft_volumerealign step and call >> ft_volumesegment directly on the mri (with cfg.coordsys = 'neuromag', or, >> for what it's worth, without cfg.coordsys; in this case you will be able to >> verify the coordinate system)? >> >> Alternatively, if this doesn't work, could you replace mri.transform by >> eye(4) prior to calling ft_volumerealign and ft_volumesegment (both with >> cfg.coordsys = 'neuromag' and no further tampering with transformation >> matrices?). >> >> >> >> Thanks >> >> >> >> JM >> >> >> >> >> >> On Apr 12, 2011, at 8:49 PM, < >> Jan.Hirschmann at med.uni-duesseldorf.de> wrote: >> >> >> >> >> Dear Jan-Mathijs, >> >> >> >> sorry, I think I was a bit too enthusiastic when I said everything worked >> out wonderfully. It worked only once. After an afternoon of confusion I >> concluded that on my first try I must have misspelled >> cfg.coordsys=’neuromag’ on my calls to ft_volumerealign and >> ft_volumesegment. In fact, the segmentation looks really bad with these >> settings. What works for me is written underneath: >> >> >> >> mri = ft_read_mri('….fif'); >> >> hdr=ft_read_header('…fif'); >> >> mri.anatomy=double(mri.anatomy); >> >> >> >> %this is taken from the Neuromag GUI for MRI-MEG Integration >> >> cfg=[]; >> >> cfg.fiducial.rpa=[136.35 142.80 31.96]; >> >> cfg.fiducial.nas=[47.84 101.80 100.10]; >> >> cfg.fiducial.lpa=[139.22 146.17 162.69]; >> >> >> >> %go from neuromag voxel to neuromag head coordinates >> >> cfg.coordsys='neuromag'; >> >> cfg.method='fiducial'; >> >> real_mri=ft_volumerealign(cfg,mri); >> >> >> >> %taking real_mri with its coordsys field will not work, so I take mri >> >> mri.transform=real_mri.transform; >> >> >> >> cfg = []; >> >> cfg.keepintermediate = 'no'; >> >> cfg.write = 'no'; >> >> segmentedmri = ft_volumesegment(cfg, mri); >> >> >> >> >> >> Before segmentation the function shows some kind of brain (pic 1). When >> segmentation is done the segmented brain looks good (pic 2) but the brain >> does not fit the helmet (pic 3). It is looking at its feet as if it dropped >> some pocket change. Do you know what is going on? >> >> >> >> Thanks, >> >> jan >> >> >> ------------------------------ >> >> *Von:* fieldtrip-bounces at donders.ru.nl [ >> mailto:fieldtrip-bounces at donders.ru.nl ] >> *Im Auftrag von *jan-mathijs schoffelen >> *Gesendet:* Dienstag, 12. April 2011 12:11 >> *An:* Email discussion list for the FieldTrip project >> *Betreff:* Re: [FieldTrip] I think you solved the problem >> >> >> >> Dear Jan, >> >> >> >> Apart from not being properly aligned, the segmentation looks a bit >> strange to me. I suspect that not everything went well here ;o). >> >> Could you try the following: >> >> >> >> specify cfg.coordsys = 'neuromag', both in your call to ft_volumerealign >> and in your call to ft_volumesegment. The cfg.coordinates for >> ft_volumesegment has to be removed (actually it is a deprecated option). The >> idea now is that mri-structures in fieldtrip can have a coordsys field, >> which allows for more transparent use of the different head coordinate >> system conventions. This takes away the need for intermediately >> coregistering the MRI in 'ctf'-convention, and would also take away your >> need to call headcoordinates later on. >> >> >> >> Best wishes, >> >> >> >> Jan-Mathijs >> >> >> >> >> >> On Apr 12, 2011, at 11:07 AM, < >> Jan.Hirschmann at med.uni-duesseldorf.de> wrote: >> >> >> >> >> >> Dear fieldtrip experts, >> >> >> >> I have two questions regarding head model creation. As noted on this >> thread, the volumesegment function was updated and I tested it for our >> Neuromag data. The segmentation is performed, but unfortunately it is not >> aligned with the MRI in my case. Here is the code I am using, the fieldtrip >> is from 9th April 2011. >> >> >> >> %read mri >> >> mri = ft_read_mri(subject_files.fiff_mri); >> >> mri.anatomy=double(mri.anatomy); >> >> >> >> %these are the fiducials for this subject taken from the Neuromag GUI for >> coregistration >> >> cfg=[]; >> >> cfg.fiducial.rpa=[136.35 142.80 31.96]; >> >> cfg.fiducial.nas=[47.84 101.80 100.10]; >> >> cfg.fiducial.lpa=[139.22 146.17 162.69]; >> >> >> >> %define the head coordinate system according to CTF conventions >> >> cfg.method='fiducial'; >> >> real_mri=ft_volumerealign(cfg,mri); >> >> >> >> %segment >> >> cfg = []; >> >> cfg.template = '/data/apps/spm/spm8/templates/T1.nii'; >> >> cfg.coordinates = 'ctf'; >> >> cfg.keepintermediate = 'no'; >> >> segmentedmri = ft_volumesegment(cfg, real_mri); >> >> >> >> %plot white matter >> >> test=segmentedmri; >> >> test.anatomy=real_mri.anatomy; >> >> cfg=[]; >> >> cfg.funparameter='white'; >> >> ft_sourceplot(cfg,test); %see attached picture >> >> >> >> The other issue regards back-transformation from CTF to Neuromag >> coordinates, which is necessary to make the head model fit the sensors. My >> idea was to create an appropriate transformation matrix like this. >> >> >> >> cd /net/avidya/storage/home/jan/fieldtrip-20110409/private >> >> ctfmat=headcoordinates(nas,lpa,rpa,'ctf'); >> >> nmmat=headcoordinates(nas,lpa,rpa,'neuromag'); >> >> ctf_to_nm=nmmat/ctfmat; >> >> >> >> >> >> And then to use it on the head model to bring it back into Neuromag >> coordinates: >> >> >> >> %create single shell, realistic headmodel >> >> cfg = []; >> >> hdm = ft_prepare_singleshell(cfg,segmentedmri); >> >> >> >> % transformation of headmodel into Neuromag space >> >> hdm.bnd.pnt=warp_apply(ctf_to_nm,hdm.bnd.pnt,'homogeneous'); >> >> >> >> Does this survive a sanity check? >> >> >> >> Best regards and thanks a lot, >> >> >> >> Jan >> >> >> >> >> ------------------------------ >> >> *Von:* fieldtrip-bounces at donders.ru.nl [ >> mailto:fieldtrip-bounces at donders.ru.nl ] >> *Im Auftrag von *Jen Whitman >> *Gesendet:* Montag, 28. Februar 2011 22:32 >> *An:* Email discussion list for the FieldTrip project >> *Betreff:* [FieldTrip] I think you solved the problem >> >> >> >> I just checked, and when I re-ran my segmentation script with the new >> Fieldtrip in order to use an spm8 template image, coordinates got reversed. >> When I take out the calls to flipdim, they look fine (see attached >> screenshots). That certainly explains the meaningless results I was getting! >> >> Thanks for figuring that out, >> >> Jen >> >> On Mon, Feb 28, 2011 at 12:36 PM, jan-mathijs schoffelen < >> jan.schoffelen at donders.ru.nl> wrote: >> >> Hi Jen, >> >> >> >> At first glance I have a comment on your script. You may need to >> explicitly check the alignment of your segmented volume and the original >> anatomy. A while a go some changes were made to ft_volumesegment, taking >> away the need to do the flipdim(flipdim... operations. I have posted this >> on the discussion list last January, but you may not have noticed. >> >> Anyway, if you now have used a recent version of FieldTrip for your >> segmentation both the location of your dipole grid, and the volume conductor >> model will not be adequately coregistered with the data, which may lead to >> funky results to begin with. That's most likely not related to the filetype >> in which the volumes are saved for later use. >> >> >> >> Best wishes, >> >> >> >> Jan-Mathijs >> >> >> >> >> >> >> >> On Feb 28, 2011, at 8:59 PM, Jen Whitman wrote: >> >> >> >> >> >> >> Hello Jan, >> >> When calling volumesegment, I specified 'ctf' as the coordinate system. >> The function I wrote to call volumesegment and prepare_singleshell for each >> subject and save the results is pasted below, with a couple of comments >> added for clarity. >> Over the weekend I tried specifying the coordinate system in the call to >> ft_volumenormalise as 'ctf' rather than 'spm', and commented out all the >> lines that said cfg.spmversion = 'spm8'; before calling a function. However, >> that created worse results, as each plot involved stripes of activation and >> empty voxels, suggesting that 'ctf' was not the correct coordinate system to >> specify. >> >> Thanks for the attached script. Looking in that the comments in that, I >> suspect that the solution to my problems will be to specify my filetype as >> nifti_img rather than nifti. I'll let you know how that goes. >> >> Jen >> >> >> ------------------------------------------------------------------------------------------------------------ >> % the variable subj is simply a string consisting of a subject number >> (e.g. 's05') which can be a folder name or part of a filename >> function [vol mri segmentedmri >> segmentedmriF]=call_volume_segment_function_spm8(subj) >> cfg.spmversion = 'spm8'; >> cfg.template = '/home/woodwardlab/spm8/templates/EPI.nii'; >> %cfg.template='/home/common/matlab/spm2/templates/T1.mnc'; >> cfg.name=[subj '_volseg']; >> cfg.write='yes'; >> cfg.smooth='no'; >> cfg.coordinates='ctf'; >> mri=read_mri([subj '/mri/' subj 'head.mri']); % made with CTF mriConverter >> and mriViewer software, after fiducials were marked >> segmentedmri = volumesegment(cfg, mri); >> segmentedmriF = segmentedmri; >> segmentedmriF.gray = flipdim(flipdim(flipdim(segmentedmriF.gray,3),2),1); >> segmentedmriF.white = >> flipdim(flipdim(flipdim(segmentedmriF.white,3),2),1); >> segmentedmriF.csf = flipdim(flipdim(flipdim(segmentedmriF.csf,3),2),1); >> segmentedmriF.transform = mri.transform; >> segmentedmriF.anatomy = mri.anatomy; >> cfg = []; >> cfg.spmversion = 'spm8'; >> vol = prepare_singleshell(cfg, segmentedmriF); >> eval(['save ' subj '/meg/mrisegmented.mat mri segmentedmri segmentedmriF >> vol']) >> >> >> >> >> >> On Sat, Feb 26, 2011 at 5:26 AM, jan-mathijs schoffelen < >> jan.schoffelen at donders.ru.nl> wrote: >> >> Dear Jen, >> >> >> >> I do not manage to reproduce your issue, when only focussing on the >> ft_volumewrite and visualization part of your pipeline. See attached script, >> and yet an updated version of ft_volumewrite which you need to (hopefully) >> draw the same conclusion as I did. >> >> Yet, I only now realize that your question may pertain to the entire >> pipeline. It could be that something is going wrong there. >> >> I only see now that in the part of your script of which you reported that >> it gave 'good' results, you specify cfg.coordinates = 'ctf' before calling >> ft_volumenormalise. I assume this is correct, because the coordinate system >> your source-reconstructed data lives in, is according to the CTF-convention, >> and not according to the SPM-convention. On the other hand, the template for >> the spatial normalization lives in the SPM-coordinate system. In order for >> the spatial normalization to work OK, Fieldtrip tries to convert from one >> coordinate system to the other (once again, this is appropriate behaviour), >> before doing the actual normalization. It seems that at least in the script >> you sent along, in the final (not working version), you specified >> cfg.coordinates = 'spm' prior to calling ft_volumenormalise. This is >> probably wrong. >> >> Another important point that should be mentioned, is that the coordinate >> systems in which the functional data and the anatomical data live should be >> the same for the ft_sourceinterpolate to make sense. In other words, if your >> source reconstructed images are defined on a 3D grid of positions in >> CTF-space, the mri.transform of your anatomy should describe a >> transformation from voxel to CTF-space. >> >> I think you may want to revisit step by step this part of the pipeline; I >> don't think the problem lies in the writing. >> >> A final possibility of course is that Mricron is misbehaving... >> >> >> >> Best, >> >> >> >> Jan-Mathijs >> >> >> >> >> >> >> >> >> >> >> >> >> >> On Feb 25, 2011, at 9:44 PM, Jen Whitman wrote: >> >> >> >> >> >> >> Hi Jan, >> >> I tried re-running the analysis with the new script you sent me, and the >> latest version of fieldtrip (since I needed ft_get_opt as well), but the >> spm8 images being written are still producing flawed results. It's the same >> problem as I mentioned briefly in my previous post. I am not getting any >> error messages when writing these images. Rather, my problem is that the >> spm8 and spm2 results from the same data ought to be identical when viewed >> in mricron, but they're far from it. When I use mricron to look at the >> results from the spm8-format images, combined across participants to create >> a t-image, I just get a single 'blob' spanning roughly half the brain. In >> contrast, when I used spm2-format previously on the same data, the t-image >> was much more meaningful; a posterior alpha power decrease in a set of >> regions corresponding to the 'task-positive network' (a network found in the >> results of an fMRI version of my experiment, and widely reported in the fMRI >> literature). >> >> This failure to replicate the spm2 results when using spm8 images from the >> same data leads me to suspect that something is wrong with the coordinates >> for spm8 format. However, after experimenting extensively with different cfg >> options I still haven't identified the problem. If I my structural MRIs have >> been saved to .mri files using CTF's MRIConverter program, which cfg >> options, particularly for coordinates, template images, and filetypes, >> should I specify before calling the ft_volumesegment, >> ft_prepare_singleshell, ft_sourceinterpolate, ft_volumenormalise, and >> ft_volumewrite functions? Or should I be calling a different set of >> functions now? >> >> Thanks again for your help, >> >> Jen >> >> On Thu, Feb 24, 2011 at 10:07 AM, Jen Whitman >> wrote: >> >> Great, thanks! >> >> I'll start the analysis with your new script today and will let you know >> how it works out. >> >> Jen >> >> On Thu, Feb 24, 2011 at 4:44 AM, jan-mathijs schoffelen < >> jan.schoffelen at donders.ru.nl> wrote: >> >> Dear Jen, >> >> >> >> I managed to reproduce your problem. The code was rather buggy and indeed >> ft_volumewrite did not behave as it should have. I now fixed it in the code >> and it should run fine now. Please find the updated file attached. It will >> be available on our ftp-server as of tonight. Please note that I updated the >> documentation, and changed the names of some of the options a bit. If you >> want to save your data in analyze-format, you should specify cfg.filetype = >> 'analyze_spm'. If you specify cfg.filetype = 'nifti', it should write out a >> volume to nifti-format, using SPM8. >> >> >> >> Best wishes, >> >> >> >> Jan-Mathijs >> >> >> >> >> >> >> >> >> >> >> >> On Feb 23, 2011, at 7:44 PM, Jen Whitman wrote: >> >> >> >> >> Dear Jan, >> >> Thanks for the quick reply. Yes, I have tried it out quite a few times >> now, experimenting with different settings in the cfgs. Below I'll paste the >> code I've been using to write images - first the code that successfully >> created spm2 images that produced good results, then the code used for >> creating nifti format images from the same data. The comments in this second >> part are at this point a bit of a maze of cfg options I've been changing >> back & forth. Any insights/suggestions regarding how to set up my cfgs to >> make this work would be greatly appreciated. >> >> Jen >> >> >> %%%%%%%% this code generated spm2-compatible images which did work >> (producing results that made sense). >> >> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% >> >> sourcetemp.avg.pow = (sourcetemp.avg.pow - sourcePre.avg.pow) ./ >> sourcePre.avg.pow; >> >> cfg = []; >> cfg.downsample = 2; >> sourcetempInt = sourceinterpolate(cfg, sourcetemp , mri); >> >> % projecting the plot onto a surface... >> cfg = []; >> cfg.coordinates = 'ctf'; >> cfg.template = '/home/common/matlab/spm2/templates/T1.mnc'; %this >> template is in MNI coordinates >> sourcetempIntN = volumenormalise(cfg, sourcetempInt); >> >> filename=[subj 'run' int2str(r) 'cond' int2str(cond) '_' int2str(f) >> 'HzWin' int2str(win) 'width750ms']; >> cfg=[]; >> cfg.parameter = 'avg.pow'; % string, describing the functional >> data to be processed, e.g. 'pow', 'coh' or 'nai' >> cfg.filename = [filename '.img']; %'testimageoutput_alphafreq'; % >> filename without the extension >> cfg.filetype = 'spm'; %'analyze', 'spm', 'vmp' or 'vmr' >> cfg.coordinates = 'spm'; %'spm, 'ctf' or empty for interactive >> (default = []) >> cfg.datatype = 'double'; %'float'; %'double'; %'bit1', 'uint8', >> 'int16', 'int32', 'float' or 'double' >> >> volumewrite(cfg, sourcetempIntN) >> >> >> >> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% >> >> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% >> >> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% >> >> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% >> %%%%% this code below hasn't worked yet... >> >> % I added cfg.spmversion = 'spm8'; >> % in the cfgs for the calls to ft_prepare_leadfield and ft_sourceanalysis, >> % and in the call to prepare_singleshell after calling volumesegment >> >> % I've also ensured that spm8 is the only spm version in my path, even in >> % the fieldtrip/external folder, and ensured that spm8 is installed >> properly >> % (files compiled correctly, etc..) >> >> sourcetemp.avg.pow = (sourcetemp.avg.pow - sourcePre.avg.pow) ./ >> sourcePre.avg.pow; >> >> filename=[subj 'run' int2str(r) 'cond' int2str(cond) '_' int2str(f) >> 'Hzspm8_FIXv9_Win' int2str(win) 'width750ms.img']; >> >> cfg = []; >> % cfg.coordinates = 'spm'; % changed for version 5 >> % cfg.spmversion = 'spm8'; % changed for version 5 >> cfg.downsample = 4; >> sourcetempInt = ft_sourceinterpolate(cfg, sourcetemp , mri); >> >> >> % projecting the plot onto a surface... >> cfg = []; >> %cfg.coordinates = 'spm'; % changed for version 5 >> %cfg.coordinates = 'ctf'; % changed for version 5 >> cfg.coordinates = 'spm'; % changed back to spm for version 9 >> cfg.downsample = 4; >> %cfg.spmversion = 'spm8'; % changed for version 6 (because this gets >> specified in volumewrite) >> cfg.template = 'Hmatrix/mask.nii.nii'; % basically equivalent to using >> spm8/templates/EPI.nii, except that mask.nii (produced from fmri data) has >> the desired voxel size >> % cfg.name = [filename]; % changed for version 6 >> %cfg.write= 'yes'; % changed for version 6 (when this was set to 'yes' >> there was no subsequent call to volumewrite) >> cfg.write= 'no'; % changed for version 6 >> sourcetempIntN = ft_volumenormalise(cfg, sourcetempInt); >> >> % this whole cfg and function call added for version 6 >> cfg=[]; >> % cfg.parameter = string, describing the functional data to be >> processed, e.g. 'pow', 'coh' or 'nai' >> % cfg.filename = filename without the extension >> % cfg.filetype = 'analyze', 'spm', 'vmp' or 'vmr' >> % cfg.vmpversion = 1 or 2 (default) version of the vmp-format to use >> % cfg.coordinates = 'spm, 'ctf' or empty for interactive (default = >> []) >> cfg.parameter='pow'; >> cfg.filename=filename; >> cfg.filetype = 'spm'; >> cfg.spmversion = 'SPM8'; % capitalized after first error message from >> vers 6 >> % cfg.dataformat='nifti'; % added after first error message from vers 6 >> % commented out after 2nd error message >> from vers 6 >> %cfg.vmpversion=2; % this is a filetype, like spm, so don't need to >> specify unless cfg.filetyp='vmp' >> cfg.coordinates='spm'; >> ft_volumewrite(cfg,sourcetempIntN); >> >> >> >> >> >> >> >> On Wed, Feb 23, 2011 at 7:50 AM, jan-mathijs schoffelen < >> jan.schoffelen at donders.ru.nl> wrote: >> >> Dear Jen, >> >> I notice that indeed in the documentation section of ft_write_volume there >> is a FIXME behind nifti. Yet, nifti format seems to be supported by >> ft_write_volume (at least in a recent version of fieldtrip). Did you try it >> at all (and ran into problems) or were you held back by the FIXME statement? >> Could you just try it out using a recent fieldtrip function? >> >> Thanks and best wishes >> >> Jan-Mathijs >> >> >> >> >> On Feb 23, 2011, at 2:21 AM, Jen Whitman wrote: >> >> Hello, >> >> While writing beamformed images to spm2 format in a previous version of >> fieldtrip (now lost due to a computer crash), I was able to get nice-looking >> results; networks of brain regions consistent with existing literature. When >> I try to write images from the same dataset and the same analysis to spm8 >> format, my results (t-images computed across subjects) end up being single >> clusters spanning large sections of the brain (e.g. a 'blob' spanning all of >> one hemisphere but not the other). Unfortunately, some aspects of my planned >> data analyses cannot be performed on spm2 images, so I have to find a way of >> writing to successfully to nifti format. >> >> I just noticed that in the comments in the ft_write_volume function, which >> I am calling via ft_volumewrite, it says 'FIXME' next to nifti under the >> list of supported dataformats. Is there by any chance a patch out there for >> writing nifti images? >> >> Thanks! >> >> _______________________________________________ >> fieldtrip mailing list >> fieldtrip at donders.ru.nl >> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip >> >> >> Dr. J.M. (Jan-Mathijs) Schoffelen >> Donders Institute for Brain, Cognition and Behaviour, >> Centre for Cognitive Neuroimaging, >> Radboud University Nijmegen, The Netherlands >> J.Schoffelen at donders.ru.nl >> Telephone: 0031-24-3614793 >> >> _______________________________________________ >> fieldtrip mailing list >> fieldtrip at donders.ru.nl >> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip >> >> >> _______________________________________________ >> fieldtrip mailing list >> fieldtrip at donders.ru.nl >> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip >> >> >> >> Dr. J.M. (Jan-Mathijs) Schoffelen >> >> Donders Institute for Brain, Cognition and Behaviour, >> Centre for Cognitive Neuroimaging, >> Radboud University Nijmegen, The Netherlands >> >> J.Schoffelen at donders.ru.nl >> >> Telephone: 0031-24-3614793 >> >> >> >> >> _______________________________________________ >> fieldtrip mailing list >> fieldtrip at donders.ru.nl >> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip >> >> >> >> >> _______________________________________________ >> fieldtrip mailing list >> fieldtrip at donders.ru.nl >> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip >> >> >> >> Dr. J.M. (Jan-Mathijs) Schoffelen >> >> Donders Institute for Brain, Cognition and Behaviour, >> Centre for Cognitive Neuroimaging, >> Radboud University Nijmegen, The Netherlands >> >> J.Schoffelen at donders.ru.nl >> >> Telephone: 0031-24-3614793 >> >> >> >> >> _______________________________________________ >> fieldtrip mailing list >> fieldtrip at donders.ru.nl >> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip >> >> >> _______________________________________________ >> fieldtrip mailing list >> fieldtrip at donders.ru.nl >> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip >> >> >> >> Dr. J.M. (Jan-Mathijs) Schoffelen >> >> Donders Institute for Brain, Cognition and Behaviour, >> Centre for Cognitive Neuroimaging, >> Radboud University Nijmegen, The Netherlands >> >> J.Schoffelen at donders.ru.nl >> >> Telephone: 0031-24-3614793 >> >> >> >> >> _______________________________________________ >> fieldtrip mailing list >> fieldtrip at donders.ru.nl >> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip >> >> >> >> >> >> _______________________________________________ >> fieldtrip mailing list >> fieldtrip at donders.ru.nl >> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip >> >> >> >> Dr. J.M. (Jan-Mathijs) Schoffelen >> >> Donders Institute for Brain, Cognition and Behaviour, >> Centre for Cognitive Neuroimaging, >> Radboud University Nijmegen, The Netherlands >> >> J.Schoffelen at donders.ru.nl >> >> Telephone: 0031-24-3614793 >> >> >> >> >> >> _______________________________________________ >> fieldtrip mailing list >> fieldtrip at donders.ru.nl >> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip >> >> >> >> Dr. J.M. (Jan-Mathijs) Schoffelen >> >> Donders Institute for Brain, Cognition and Behaviour, >> Centre for Cognitive Neuroimaging, >> Radboud University Nijmegen, The Netherlands >> >> J.Schoffelen at donders.ru.nl >> >> Telephone: 0031-24-3614793 >> >> >> >> >> >> _______________________________________________ >> fieldtrip mailing list >> fieldtrip at donders.ru.nl >> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip >> >> >> >> Dr. J.M. (Jan-Mathijs) Schoffelen >> >> Donders Institute for Brain, Cognition and Behaviour, >> Centre for Cognitive Neuroimaging, >> Radboud University Nijmegen, The Netherlands >> >> J.Schoffelen at donders.ru.nl >> >> Telephone: 0031-24-3614793 >> >> >> >> _______________________________________________ >> fieldtrip mailing list >> fieldtrip at donders.ru.nl >> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip >> > > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: pic2.jpg Type: image/jpeg Size: 19281 bytes Desc: not available URL: From Jan.Hirschmann at med.uni-duesseldorf.de Fri Apr 15 13:29:46 2011 From: Jan.Hirschmann at med.uni-duesseldorf.de (Jan.Hirschmann at med.uni-duesseldorf.de) Date: Fri, 15 Apr 2011 13:29:46 +0200 Subject: [FieldTrip] I think you solved the problem In-Reply-To: References: <72E993C35FB11743B79FF9286E5B6D8B02676142@Mail2-UKD.VMED.UKD><7B5CA863-D143-404C-BCB9-805AA6E6E546@donders.ru.nl><72E993C35FB11743B79FF9286E5B6D8B02676264@Mail2-UKD.VMED.UKD><72E993C35FB11743B79FF9286E5B6D8B026763B8@Mail2-UKD.VMED.UKD><5AC469DB-D5B1-4E3C-AE21-01A53AE94A26@donders.ru.nl><72E993C35FB11743B79FF9286E5B6D8B02676493@Mail2-UKD.VMED.UKD> Message-ID: <72E993C35FB11743B79FF9286E5B6D8B026766A9@Mail2-UKD.VMED.UKD> Hi Hanneke, it occured to me to change x and y when I clicked around in the mri presented to me by vt_voulmesegment (it shows up when cfg.coordsys is not specified). I noticed that a voxel that had index [i j k] in the neuromag GUI had index [j i k] in this image. But when you specify the fiducials manually in fieldtrip, I don't think you have to worry about that. You could try not to swap x and y coordinates and comment out cfg.coordsys in the segmentation part. In the picture that comes up, do the axes go through the fiducials (y through nas)? If so, the alignment is correct. To my mind, the big helmet in your picture could mean that the sensor positions are given in cm and the headmodel vertices in m. What happens if you multiply headmodel.pos by 10? Best, jan ________________________________ Von: fieldtrip-bounces at donders.ru.nl [mailto:fieldtrip-bounces at donders.ru.nl] Im Auftrag von Hanneke van Dijk Gesendet: Freitag, 15. April 2011 11:34 An: Email discussion list for the FieldTrip project Betreff: Re: [FieldTrip] I think you solved the problem Dear Jan and Jan-Mathijs, Thanks for working on this problem! I'm testing it for data recorded with the 'old' neuromag 122 system. I'm using the script that Jan attached to a previous e-mail, and the fieldtrip version that was released yesterday. The first question that I have is: What to do if you don't have fiducial information from the neuromag software? I could use ft_volume_realign with cfg.method = 'interactive' and point the fiducials out and swap the y and x axes. But in what coordinate system am I then, and in what coordinate system should I move on? second, My 'vol' , headmodel, seems to end up in a factor 10 (or more(?)) smaller unit then the grid and grad. You can't even see it in the headmodelplot (it is a small dot somewhere in the middle). I don't know what happened there. third, If you look at the picture I attached the grid is not in the centre of the helmet (pic1 from the top down), and very low (pic2 looking from the left). I don't know how to solve that. I at least think the subject was not in the helmet that way! Groetjes Hanneke -------------------------------------------------- Dr. Hanneke van Dijk Institut für Klinische Neurowissenschaften und Medizinische Psychologie Gebäude-Nr.: 23.02 Ebene: 03 Zimmer-Nr.: 47 Tel.: +49 211-81-13074 Mail : hanneke.vandijk at med.uni-duesseldorf.de http://www.uniklinik-duesseldorf.de/deutsch/unternehmen/institute/KlinNeurowiss/Team/HannekevanDijk/page.html On Thu, Apr 14, 2011 at 9:31 AM, wrote: Dear Jan-Mathijs, sure, I will do that. I have tested one head model with ft_dipole_simulation and beamforming and it looks good (at least when I simulate two conditions and subtract sources the right location comes out). So I guess we (and maybe others) will use the new procedure now. Best, jan ________________________________ Von: fieldtrip-bounces at donders.ru.nl [mailto:fieldtrip-bounces at donders.ru.nl] Im Auftrag von jan-mathijs schoffelen Gesendet: Mittwoch, 13. April 2011 16:57 An: Email discussion list for the FieldTrip project Betreff: Re: [FieldTrip] I think you solved the problem Dear Jan, No problem. Thanks for the script. If you feel up to it, you are kindly invited to update the documentation on the fieldtrip wiki as well. If I recall correctly, at some point Hanneke added some documentation about how to create MNI-based dipole grids for neuromag data. A lot of the intermediate steps have now become obsolete and this part of the wiki can be substantially cleaned. Thanks, Jan-Mathijs On Apr 13, 2011, at 2:31 PM, wrote: Dear Jan-Mathijs, I think we solved the problem. Everthing is like you said in the first place. ft_volumerealign and ft_volumesegment should be called with cfg.coordsys='neuromag'. The only thing that was wrong is that for the voxel coordinates read from the Neuromag GUI x and y should be swapped. For anyone interested I attach a script that is meant to be easy-to-use for beginners. Thank you very much for your time! ________________________________ Von: fieldtrip-bounces at donders.ru.nl [mailto:fieldtrip-bounces at donders.ru.nl] Im Auftrag von jan-mathijs schoffelen Gesendet: Dienstag, 12. April 2011 21:18 An: Email discussion list for the FieldTrip project Betreff: Re: [FieldTrip] I think you solved the problem Dear Jan, I suspect that your mri, as it comes out of ft_read_mri is already coregistered in neuromag space. After your realignment and after replacing mri.transform with real_mri.transform, the coordinate axes in your pic1 look strange. This I think causes the 'dropped pocket change'. What happens if you skip the ft_volumerealign step and call ft_volumesegment directly on the mri (with cfg.coordsys = 'neuromag', or, for what it's worth, without cfg.coordsys; in this case you will be able to verify the coordinate system)? Alternatively, if this doesn't work, could you replace mri.transform by eye(4) prior to calling ft_volumerealign and ft_volumesegment (both with cfg.coordsys = 'neuromag' and no further tampering with transformation matrices?). Thanks JM On Apr 12, 2011, at 8:49 PM, wrote: Dear Jan-Mathijs, sorry, I think I was a bit too enthusiastic when I said everything worked out wonderfully. It worked only once. After an afternoon of confusion I concluded that on my first try I must have misspelled cfg.coordsys='neuromag' on my calls to ft_volumerealign and ft_volumesegment. In fact, the segmentation looks really bad with these settings. What works for me is written underneath: mri = ft_read_mri('....fif'); hdr=ft_read_header('...fif'); mri.anatomy=double(mri.anatomy); %this is taken from the Neuromag GUI for MRI-MEG Integration cfg=[]; cfg.fiducial.rpa=[136.35 142.80 31.96]; cfg.fiducial.nas=[47.84 101.80 100.10]; cfg.fiducial.lpa=[139.22 146.17 162.69]; %go from neuromag voxel to neuromag head coordinates cfg.coordsys='neuromag'; cfg.method='fiducial'; real_mri=ft_volumerealign(cfg,mri); %taking real_mri with its coordsys field will not work, so I take mri mri.transform=real_mri.transform; cfg = []; cfg.keepintermediate = 'no'; cfg.write = 'no'; segmentedmri = ft_volumesegment(cfg, mri); Before segmentation the function shows some kind of brain (pic 1). When segmentation is done the segmented brain looks good (pic 2) but the brain does not fit the helmet (pic 3). It is looking at its feet as if it dropped some pocket change. Do you know what is going on? Thanks, jan ________________________________ Von: fieldtrip-bounces at donders.ru.nl [mailto:fieldtrip-bounces at donders.ru.nl] Im Auftrag von jan-mathijs schoffelen Gesendet: Dienstag, 12. April 2011 12:11 An: Email discussion list for the FieldTrip project Betreff: Re: [FieldTrip] I think you solved the problem Dear Jan, Apart from not being properly aligned, the segmentation looks a bit strange to me. I suspect that not everything went well here ;o). Could you try the following: specify cfg.coordsys = 'neuromag', both in your call to ft_volumerealign and in your call to ft_volumesegment. The cfg.coordinates for ft_volumesegment has to be removed (actually it is a deprecated option). The idea now is that mri-structures in fieldtrip can have a coordsys field, which allows for more transparent use of the different head coordinate system conventions. This takes away the need for intermediately coregistering the MRI in 'ctf'-convention, and would also take away your need to call headcoordinates later on. Best wishes, Jan-Mathijs On Apr 12, 2011, at 11:07 AM, wrote: Dear fieldtrip experts, I have two questions regarding head model creation. As noted on this thread, the volumesegment function was updated and I tested it for our Neuromag data. The segmentation is performed, but unfortunately it is not aligned with the MRI in my case. Here is the code I am using, the fieldtrip is from 9th April 2011. %read mri mri = ft_read_mri(subject_files.fiff_mri); mri.anatomy=double(mri.anatomy); %these are the fiducials for this subject taken from the Neuromag GUI for coregistration cfg=[]; cfg.fiducial.rpa=[136.35 142.80 31.96]; cfg.fiducial.nas=[47.84 101.80 100.10]; cfg.fiducial.lpa=[139.22 146.17 162.69]; %define the head coordinate system according to CTF conventions cfg.method='fiducial'; real_mri=ft_volumerealign(cfg,mri); %segment cfg = []; cfg.template = '/data/apps/spm/spm8/templates/T1.nii'; cfg.coordinates = 'ctf'; cfg.keepintermediate = 'no'; segmentedmri = ft_volumesegment(cfg, real_mri); %plot white matter test=segmentedmri; test.anatomy=real_mri.anatomy; cfg=[]; cfg.funparameter='white'; ft_sourceplot(cfg,test); %see attached picture The other issue regards back-transformation from CTF to Neuromag coordinates, which is necessary to make the head model fit the sensors. My idea was to create an appropriate transformation matrix like this. cd /net/avidya/storage/home/jan/fieldtrip-20110409/private ctfmat=headcoordinates(nas,lpa,rpa,'ctf'); nmmat=headcoordinates(nas,lpa,rpa,'neuromag'); ctf_to_nm=nmmat/ctfmat; And then to use it on the head model to bring it back into Neuromag coordinates: %create single shell, realistic headmodel cfg = []; hdm = ft_prepare_singleshell(cfg,segmentedmri); % transformation of headmodel into Neuromag space hdm.bnd.pnt=warp_apply(ctf_to_nm,hdm.bnd.pnt,'homogeneous'); Does this survive a sanity check? Best regards and thanks a lot, Jan ________________________________ Von: fieldtrip-bounces at donders.ru.nl [mailto:fieldtrip-bounces at donders.ru.nl] Im Auftrag von Jen Whitman Gesendet: Montag, 28. Februar 2011 22:32 An: Email discussion list for the FieldTrip project Betreff: [FieldTrip] I think you solved the problem I just checked, and when I re-ran my segmentation script with the new Fieldtrip in order to use an spm8 template image, coordinates got reversed. When I take out the calls to flipdim, they look fine (see attached screenshots). That certainly explains the meaningless results I was getting! Thanks for figuring that out, Jen On Mon, Feb 28, 2011 at 12:36 PM, jan-mathijs schoffelen wrote: Hi Jen, At first glance I have a comment on your script. You may need to explicitly check the alignment of your segmented volume and the original anatomy. A while a go some changes were made to ft_volumesegment, taking away the need to do the flipdim(flipdim... operations. I have posted this on the discussion list last January, but you may not have noticed. Anyway, if you now have used a recent version of FieldTrip for your segmentation both the location of your dipole grid, and the volume conductor model will not be adequately coregistered with the data, which may lead to funky results to begin with. That's most likely not related to the filetype in which the volumes are saved for later use. Best wishes, Jan-Mathijs On Feb 28, 2011, at 8:59 PM, Jen Whitman wrote: Hello Jan, When calling volumesegment, I specified 'ctf' as the coordinate system. The function I wrote to call volumesegment and prepare_singleshell for each subject and save the results is pasted below, with a couple of comments added for clarity. Over the weekend I tried specifying the coordinate system in the call to ft_volumenormalise as 'ctf' rather than 'spm', and commented out all the lines that said cfg.spmversion = 'spm8'; before calling a function. However, that created worse results, as each plot involved stripes of activation and empty voxels, suggesting that 'ctf' was not the correct coordinate system to specify. Thanks for the attached script. Looking in that the comments in that, I suspect that the solution to my problems will be to specify my filetype as nifti_img rather than nifti. I'll let you know how that goes. Jen ------------------------------------------------------------------------------------------------------------ % the variable subj is simply a string consisting of a subject number (e.g. 's05') which can be a folder name or part of a filename function [vol mri segmentedmri segmentedmriF]=call_volume_segment_function_spm8(subj) cfg.spmversion = 'spm8'; cfg.template = '/home/woodwardlab/spm8/templates/EPI.nii'; %cfg.template='/home/common/matlab/spm2/templates/T1.mnc'; cfg.name=[subj '_volseg']; cfg.write='yes'; cfg.smooth='no'; cfg.coordinates='ctf'; mri=read_mri([subj '/mri/' subj 'head.mri']); % made with CTF mriConverter and mriViewer software, after fiducials were marked segmentedmri = volumesegment(cfg, mri); segmentedmriF = segmentedmri; segmentedmriF.gray = flipdim(flipdim(flipdim(segmentedmriF.gray,3),2),1); segmentedmriF.white = flipdim(flipdim(flipdim(segmentedmriF.white,3),2),1); segmentedmriF.csf = flipdim(flipdim(flipdim(segmentedmriF.csf,3),2),1); segmentedmriF.transform = mri.transform; segmentedmriF.anatomy = mri.anatomy; cfg = []; cfg.spmversion = 'spm8'; vol = prepare_singleshell(cfg, segmentedmriF); eval(['save ' subj '/meg/mrisegmented.mat mri segmentedmri segmentedmriF vol']) On Sat, Feb 26, 2011 at 5:26 AM, jan-mathijs schoffelen wrote: Dear Jen, I do not manage to reproduce your issue, when only focussing on the ft_volumewrite and visualization part of your pipeline. See attached script, and yet an updated version of ft_volumewrite which you need to (hopefully) draw the same conclusion as I did. Yet, I only now realize that your question may pertain to the entire pipeline. It could be that something is going wrong there. I only see now that in the part of your script of which you reported that it gave 'good' results, you specify cfg.coordinates = 'ctf' before calling ft_volumenormalise. I assume this is correct, because the coordinate system your source-reconstructed data lives in, is according to the CTF-convention, and not according to the SPM-convention. On the other hand, the template for the spatial normalization lives in the SPM-coordinate system. In order for the spatial normalization to work OK, Fieldtrip tries to convert from one coordinate system to the other (once again, this is appropriate behaviour), before doing the actual normalization. It seems that at least in the script you sent along, in the final (not working version), you specified cfg.coordinates = 'spm' prior to calling ft_volumenormalise. This is probably wrong. Another important point that should be mentioned, is that the coordinate systems in which the functional data and the anatomical data live should be the same for the ft_sourceinterpolate to make sense. In other words, if your source reconstructed images are defined on a 3D grid of positions in CTF-space, the mri.transform of your anatomy should describe a transformation from voxel to CTF-space. I think you may want to revisit step by step this part of the pipeline; I don't think the problem lies in the writing. A final possibility of course is that Mricron is misbehaving... Best, Jan-Mathijs On Feb 25, 2011, at 9:44 PM, Jen Whitman wrote: Hi Jan, I tried re-running the analysis with the new script you sent me, and the latest version of fieldtrip (since I needed ft_get_opt as well), but the spm8 images being written are still producing flawed results. It's the same problem as I mentioned briefly in my previous post. I am not getting any error messages when writing these images. Rather, my problem is that the spm8 and spm2 results from the same data ought to be identical when viewed in mricron, but they're far from it. When I use mricron to look at the results from the spm8-format images, combined across participants to create a t-image, I just get a single 'blob' spanning roughly half the brain. In contrast, when I used spm2-format previously on the same data, the t-image was much more meaningful; a posterior alpha power decrease in a set of regions corresponding to the 'task-positive network' (a network found in the results of an fMRI version of my experiment, and widely reported in the fMRI literature). This failure to replicate the spm2 results when using spm8 images from the same data leads me to suspect that something is wrong with the coordinates for spm8 format. However, after experimenting extensively with different cfg options I still haven't identified the problem. If I my structural MRIs have been saved to .mri files using CTF's MRIConverter program, which cfg options, particularly for coordinates, template images, and filetypes, should I specify before calling the ft_volumesegment, ft_prepare_singleshell, ft_sourceinterpolate, ft_volumenormalise, and ft_volumewrite functions? Or should I be calling a different set of functions now? Thanks again for your help, Jen On Thu, Feb 24, 2011 at 10:07 AM, Jen Whitman wrote: Great, thanks! I'll start the analysis with your new script today and will let you know how it works out. Jen On Thu, Feb 24, 2011 at 4:44 AM, jan-mathijs schoffelen wrote: Dear Jen, I managed to reproduce your problem. The code was rather buggy and indeed ft_volumewrite did not behave as it should have. I now fixed it in the code and it should run fine now. Please find the updated file attached. It will be available on our ftp-server as of tonight. Please note that I updated the documentation, and changed the names of some of the options a bit. If you want to save your data in analyze-format, you should specify cfg.filetype = 'analyze_spm'. If you specify cfg.filetype = 'nifti', it should write out a volume to nifti-format, using SPM8. Best wishes, Jan-Mathijs On Feb 23, 2011, at 7:44 PM, Jen Whitman wrote: Dear Jan, Thanks for the quick reply. Yes, I have tried it out quite a few times now, experimenting with different settings in the cfgs. Below I'll paste the code I've been using to write images - first the code that successfully created spm2 images that produced good results, then the code used for creating nifti format images from the same data. The comments in this second part are at this point a bit of a maze of cfg options I've been changing back & forth. Any insights/suggestions regarding how to set up my cfgs to make this work would be greatly appreciated. Jen %%%%%%%% this code generated spm2-compatible images which did work (producing results that made sense). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% sourcetemp.avg.pow = (sourcetemp.avg.pow - sourcePre.avg.pow) ./ sourcePre.avg.pow; cfg = []; cfg.downsample = 2; sourcetempInt = sourceinterpolate(cfg, sourcetemp , mri); % projecting the plot onto a surface... cfg = []; cfg.coordinates = 'ctf'; cfg.template = '/home/common/matlab/spm2/templates/T1.mnc'; %this template is in MNI coordinates sourcetempIntN = volumenormalise(cfg, sourcetempInt); filename=[subj 'run' int2str(r) 'cond' int2str(cond) '_' int2str(f) 'HzWin' int2str(win) 'width750ms']; cfg=[]; cfg.parameter = 'avg.pow'; % string, describing the functional data to be processed, e.g. 'pow', 'coh' or 'nai' cfg.filename = [filename '.img']; %'testimageoutput_alphafreq'; % filename without the extension cfg.filetype = 'spm'; %'analyze', 'spm', 'vmp' or 'vmr' cfg.coordinates = 'spm'; %'spm, 'ctf' or empty for interactive (default = []) cfg.datatype = 'double'; %'float'; %'double'; %'bit1', 'uint8', 'int16', 'int32', 'float' or 'double' volumewrite(cfg, sourcetempIntN) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%% this code below hasn't worked yet... % I added cfg.spmversion = 'spm8'; % in the cfgs for the calls to ft_prepare_leadfield and ft_sourceanalysis, % and in the call to prepare_singleshell after calling volumesegment % I've also ensured that spm8 is the only spm version in my path, even in % the fieldtrip/external folder, and ensured that spm8 is installed properly % (files compiled correctly, etc..) sourcetemp.avg.pow = (sourcetemp.avg.pow - sourcePre.avg.pow) ./ sourcePre.avg.pow; filename=[subj 'run' int2str(r) 'cond' int2str(cond) '_' int2str(f) 'Hzspm8_FIXv9_Win' int2str(win) 'width750ms.img']; cfg = []; % cfg.coordinates = 'spm'; % changed for version 5 % cfg.spmversion = 'spm8'; % changed for version 5 cfg.downsample = 4; sourcetempInt = ft_sourceinterpolate(cfg, sourcetemp , mri); % projecting the plot onto a surface... cfg = []; %cfg.coordinates = 'spm'; % changed for version 5 %cfg.coordinates = 'ctf'; % changed for version 5 cfg.coordinates = 'spm'; % changed back to spm for version 9 cfg.downsample = 4; %cfg.spmversion = 'spm8'; % changed for version 6 (because this gets specified in volumewrite) cfg.template = 'Hmatrix/mask.nii.nii'; % basically equivalent to using spm8/templates/EPI.nii, except that mask.nii (produced from fmri data) has the desired voxel size % cfg.name = [filename]; % changed for version 6 %cfg.write= 'yes'; % changed for version 6 (when this was set to 'yes' there was no subsequent call to volumewrite) cfg.write= 'no'; % changed for version 6 sourcetempIntN = ft_volumenormalise(cfg, sourcetempInt); % this whole cfg and function call added for version 6 cfg=[]; % cfg.parameter = string, describing the functional data to be processed, e.g. 'pow', 'coh' or 'nai' % cfg.filename = filename without the extension % cfg.filetype = 'analyze', 'spm', 'vmp' or 'vmr' % cfg.vmpversion = 1 or 2 (default) version of the vmp-format to use % cfg.coordinates = 'spm, 'ctf' or empty for interactive (default = []) cfg.parameter='pow'; cfg.filename=filename; cfg.filetype = 'spm'; cfg.spmversion = 'SPM8'; % capitalized after first error message from vers 6 % cfg.dataformat='nifti'; % added after first error message from vers 6 % commented out after 2nd error message from vers 6 %cfg.vmpversion=2; % this is a filetype, like spm, so don't need to specify unless cfg.filetyp='vmp' cfg.coordinates='spm'; ft_volumewrite(cfg,sourcetempIntN); On Wed, Feb 23, 2011 at 7:50 AM, jan-mathijs schoffelen wrote: Dear Jen, I notice that indeed in the documentation section of ft_write_volume there is a FIXME behind nifti. Yet, nifti format seems to be supported by ft_write_volume (at least in a recent version of fieldtrip). Did you try it at all (and ran into problems) or were you held back by the FIXME statement? Could you just try it out using a recent fieldtrip function? Thanks and best wishes Jan-Mathijs On Feb 23, 2011, at 2:21 AM, Jen Whitman wrote: Hello, While writing beamformed images to spm2 format in a previous version of fieldtrip (now lost due to a computer crash), I was able to get nice-looking results; networks of brain regions consistent with existing literature. When I try to write images from the same dataset and the same analysis to spm8 format, my results (t-images computed across subjects) end up being single clusters spanning large sections of the brain (e.g. a 'blob' spanning all of one hemisphere but not the other). Unfortunately, some aspects of my planned data analyses cannot be performed on spm2 images, so I have to find a way of writing to successfully to nifti format. I just noticed that in the comments in the ft_write_volume function, which I am calling via ft_volumewrite, it says 'FIXME' next to nifti under the list of supported dataformats. Is there by any chance a patch out there for writing nifti images? Thanks! _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip -------------- next part -------------- An HTML attachment was scrubbed... URL: From bick35 at gmail.com Fri Apr 15 20:12:02 2011 From: bick35 at gmail.com (Steph Bickel) Date: Fri, 15 Apr 2011 14:12:02 -0400 Subject: [FieldTrip] Postdoc position available in New York Message-ID: Post doctoral research position available for research using a multimodal imaging approach at the Hofstra University School of Medicine in partnership with the North Shore LIJ Health System, NY, USA. Studies involve surgical epilepsy patients undergoing intracranial electrophysiological monitoring for seizure detection and functional electrical stimulation mapping. Ongoing research projects include: 1) validation of task-based and resting state fMRI and DTI using electrical stimulation mapping and ECog; 2) investigation of the neuronal dynamics underlying selective attention and active sensing, language, object identification and auditory stream analysis; and 3) prediction of seizure spread using electrophysiological and MRI markers. Responsibilities will include designing and overseeing fMRI and ECoG experiments, data analysis and the coordination of access to patients for research studies. Candidates should have M.D. and/or Ph.D. degrees and have some background in fMRI, electrophysiology, and/or data analysis (Matlab). Please submit CV and short statement of interest to Dr. Ashesh Mehta at *amehta at nshs.edu* for more information. -------------- next part -------------- An HTML attachment was scrubbed... URL: From bick35 at gmail.com Sat Apr 16 00:04:38 2011 From: bick35 at gmail.com (Steph Bickel) Date: Fri, 15 Apr 2011 18:04:38 -0400 Subject: [FieldTrip] Postdoc position available in New York for intracranial EEG and fMRI Message-ID: Post doctoral research position available for research using a multimodal imaging approach at the Hofstra University School of Medicine in partnership with the North Shore LIJ Health System, NY, USA. Studies involve surgical epilepsy patients undergoing intracranial electrophysiological monitoring for seizure detection and functional electrical stimulation mapping. Ongoing research projects include: 1) validation of task-based and resting state fMRI and DTI using electrical stimulation mapping and ECog; 2) investigation of the neuronal dynamics underlying selective attention and active sensing, language, object identification and auditory stream analysis; and 3) prediction of seizure spread using electrophysiological and MRI markers. Responsibilities will include designing and overseeing fMRI and ECoG experiments, data analysis and the coordination of access to patients for research studies. Candidates should have M.D. and/or Ph.D. degrees and have some background in fMRI, electrophysiology, and/or data analysis (Matlab). Please submit CV and short statement of interest to Dr. Ashesh Mehta at *amehta at nshs.edu* for more information. -------------- next part -------------- An HTML attachment was scrubbed... URL: From max.taubert at gmail.com Sun Apr 17 13:44:31 2011 From: max.taubert at gmail.com (Max T.) Date: Sun, 17 Apr 2011 13:44:31 +0200 Subject: [FieldTrip] using a four shell model Message-ID: Dear all, I am new to fieldtrip and I currently tried to do a simple dipole fit on simulated data. I tried to analyse EEG data (33 channels) which was forward modeled (outside fieldtrip) using a single dipole and a four shell headmodel with radii of 85mm for the head, 6mm for the scalp, 7mm for the bone and 1mm for the csf. I tried several ideas on how to transfer this head model into fieldtrip. Unfortunately, none of my dipole fits inside fieldtrip suited my forward model. My script looks like this: avg = besa2fieldtrip('data.mul'); avg.elec = ft_read_sens('data_elec.sfp'); vol.o = [0 0 0]; vol.r = [0.84 0.85 0.92 1]; vol.c = [0.3300 1 0.0042 0.3300]; cfg = []; cfg.elec = avg.elec; cfg.vol = vol; cfg.gridsearch = 'no'; cfg.model = 'regional'; dipol = ft_dipolefitting(cfg,avg); I would appreciate any help with this. Max Taubert From bleichner.martin at gmail.com Mon Apr 18 11:39:32 2011 From: bleichner.martin at gmail.com (Martin Bleichner) Date: Mon, 18 Apr 2011 11:39:32 +0200 Subject: [FieldTrip] BCI in 2011 and 8th BCI2000 workshop: Early Registration Deadline April 20th In-Reply-To: References: Message-ID: Dear Colleague, Please note that the early registration-deadline for the two-day symposium 'Brain-Computer Interfacing in 2011' and the 8th BCI2000 workshop is approaching fast. After April 20th, participation is subject to increased registration fees. If you are interested in interfacing with the human brain, and would like to learn about the future directions of BCI research, register now on www.bci2011.eu. Yours Sincerely, The Organizing Committee ------------------------------ *‘Brain-Computer Interfacing in 20**1**1**’* What is this? A two-day symposium on Brain-Computer Interfacing When and Where? Utrecht, Netherlands, May 20&21, 2011 By Whom? UMC Utrecht/Rudolf Magnus Institute and the BrainGain Consortium For Whom? Anyone interested in: Human Brain Function Interfacing with the human brain and mind Developing solutions for paralyzed patients Who speaks? Brendan Allison, Bernhard Graimann, Eberhard Fetz, Beata Jarosiewicz, Jean-Philippe Lachaux, Eric Leuthardt, Phil Kennedy, Christa Neuper, Nick Ramsey, Gerwin Schalk, Bill Shain, Andrew Schwartz, Jonathan Wolpaw For more information, please visit www.bci2011.eu ** *T**he **8th **BCI2000 workshop* What is this? A two-day workshop on Brain-Computer Interfacing and BCI2000 When and Where? Utrecht, Netherlands, May 18&19, 2011 By Whom? UMC Utrecht/Rudolf Magnus Institute and BCI2000 For Whom? Anyone interested in: Human Brain Function Interfacing with the human brain and mind Developing solutions for paralyzed patients Program: Lectures that describe relevant technical aspects of the BCI2000 system including implementation with C++, Matlab, Fieldtrip or Python. Hands‐on practical tutorials where participants use BCI systems to control a cursor on a computer screen and to spell words just by thinking. Exercises, in which participants build and configure a BCI with their own signal processing methods, applications, or assistive devices. For more information, please visit www.bci2011.eu -------------- next part -------------- An HTML attachment was scrubbed... URL: From a.llera at donders.ru.nl Tue Apr 19 14:39:26 2011 From: a.llera at donders.ru.nl (Alberto Llera) Date: Tue, 19 Apr 2011 14:39:26 +0200 Subject: [FieldTrip] question In-Reply-To: References: Message-ID: Hey Martin I am trying to register for the symposium, and i came across a little problem. Do you know what the enrollment number it is? Thanks in advanced and see you in Utrech (again) Alberto ------------------- > Dear Colleague, > > > > Please note that the early registration-deadline for the two-day symposium > 'Brain-Computer Interfacing in 2011' and the 8th BCI2000 workshop is > approaching fast. After April 20th, participation is subject to increased > registration fees. > > > > If you are interested in interfacing with the human brain, and would like > to > learn about the future directions of BCI research, register now on > www.bci2011.eu. > > > > Yours Sincerely, > > The Organizing Committee > > > ------------------------------ > > > > > > *‘Brain-Computer Interfacing in 20**1**1**’* > > > > What is this? A two-day symposium on Brain-Computer > Interfacing > > > > When and Where? Utrecht, Netherlands, May 20&21, 2011 > > > > By Whom? UMC Utrecht/Rudolf Magnus Institute and the > BrainGain Consortium > > > > For Whom? Anyone interested in: > > Human Brain Function > > Interfacing with the human brain > and > mind > > Developing solutions for paralyzed > patients > > > > Who speaks? Brendan Allison, Bernhard Graimann, Eberhard > Fetz, Beata Jarosiewicz, Jean-Philippe Lachaux, Eric Leuthardt, > > Phil Kennedy, Christa Neuper, Nick > Ramsey, Gerwin Schalk, Bill Shain, Andrew Schwartz, Jonathan Wolpaw > > > > For more information, please visit www.bci2011.eu > > > > > > ** > > *T**he **8th **BCI2000 workshop* > > > What is this? A two-day workshop on Brain-Computer > Interfacing and BCI2000 > > > > When and Where? Utrecht, Netherlands, May 18&19, 2011 > > > > By Whom? UMC Utrecht/Rudolf Magnus Institute and BCI2000 > > > > For Whom? Anyone interested in: > > Human Brain Function > > Interfacing with the human brain and > mind > > Developing solutions for paralyzed > patients > > > > Program: Lectures that describe relevant technical > aspects of the BCI2000 system including implementation with C++, > Matlab, Fieldtrip or Python. > > Hands‐on practical tutorials where > participants use BCI systems to control a cursor on a computer screen and > to > spell words just by thinking. > > Exercises, in which participants > build > and configure a BCI with their own signal processing methods, > applications, > or assistive devices. > > > > For more information, please visit www.bci2011.eu > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip -- Alberto Llera Arenas Ph.D. Student Donders Institute for Brain, Cognition and Behaviour Radboud University Nijmegen Geert Grooteplein 21, route 126 Nijmegen, The Netherlands Tel: +31(0)24 3614230 http://www.mbfys.ru.nl/staff/a.llera/ From H.Rossiter at ion.ucl.ac.uk Wed Apr 20 12:48:08 2011 From: H.Rossiter at ion.ucl.ac.uk (Holly Rossiter) Date: Wed, 20 Apr 2011 11:48:08 +0100 Subject: [FieldTrip] FFT on EMG data Message-ID: <004701cbff48$6fe11020$4fa33060$@Rossiter@ion.ucl.ac.uk> Hi, I am trying to run an FFT on some EMG data to obtain the peak frequency. This is the script I am using... D= spm_eeg_load; emg = D.ftraw(0); cfg=[]; cfg.method='mtmfft'; cfg.output='pow'; cfg.taper='hanning'; cfg.channel={'Lforearm'}; cfg.foi= [5 80];% frequency band - foilim or just foi?? freq=ft_freqanalysis(cfg,emg); figure semilogy(freq.freq, freq.powspctrm(1,:), 'b-'); However, I keep getting this error... processing trial 1, ??? Undefined function or variable "dum". Error in ==> ft_freqanalysis_mtmfft at 345 fprintf('nfft: %d samples, taper length: %d samples, %d tapers\n',length(dum),size(tap,2),numtap); Error in ==> ft_freqanalysis at 111 [freq] = feval(sprintf('ft_freqanalysis_%s',lower(cfg.method)), cfg, data); Do you know how to fix this error? Thanks, Holly -------------- next part -------------- An HTML attachment was scrubbed... URL: From jan.schoffelen at donders.ru.nl Wed Apr 20 13:50:12 2011 From: jan.schoffelen at donders.ru.nl (jan-mathijs schoffelen) Date: Wed, 20 Apr 2011 13:50:12 +0200 Subject: [FieldTrip] FFT on EMG data In-Reply-To: <004701cbff48$6fe11020$4fa33060$@Rossiter@ion.ucl.ac.uk> References: <004701cbff48$6fe11020$4fa33060$@Rossiter@ion.ucl.ac.uk> Message-ID: <06E20A36-FFC2-4D83-AB63-F48FA0D2F0D1@donders.ru.nl> Hi Holly, What version of fieldtrip are you using? Best Jan-M On Apr 20, 2011, at 12:48 PM, Holly Rossiter wrote: > Hi, > > I am trying to run an FFT on some EMG data to obtain the peak > frequency. This is the script I am using... > > D= spm_eeg_load; > emg = D.ftraw(0); > > cfg=[]; > > cfg.method='mtmfft'; > cfg.output='pow'; > cfg.taper='hanning'; > cfg.channel={'Lforearm'}; > cfg.foi= [5 80];% frequency band - foilim or just foi?? > freq=ft_freqanalysis(cfg,emg); > > figure > semilogy(freq.freq, freq.powspctrm(1,:), 'b-'); > > However, I keep getting this error... > > processing trial 1, ??? Undefined function or variable "dum". > > Error in ==> ft_freqanalysis_mtmfft at 345 > fprintf('nfft: %d samples, taper length: %d samples, %d > tapers\n',length(dum),size(tap,2),numtap); > > Error in ==> ft_freqanalysis at 111 > [freq] = > feval(sprintf('ft_freqanalysis_%s',lower(cfg.method)), cfg, > data); > > Do you know how to fix this error? > > Thanks, > > Holly > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 -------------- next part -------------- An HTML attachment was scrubbed... URL: From max.taubert at gmail.com Wed Apr 20 16:08:39 2011 From: max.taubert at gmail.com (Max T.) Date: Wed, 20 Apr 2011 16:08:39 +0200 Subject: [FieldTrip] [Fieldtrip] dipole-fitting problem Message-ID: Dear all, I am new to fieldtrip and I currently tried to do a simple dipole fit on EEG data using a four-shell headmodel. The data consists of 96 trials which I preprocess and average through fieldtrip, then I do the dipole fit using two symmetric dipoles. As I only wanted to try out the fitting-capabilities of fieldtrip, I skipped artifact detection etc. The problem I encountered is that the fitting results from fieldtrip vastly differ from results that come from BESA, the dipoles have totaly different positions. May this be caused by the different algorithms of FT and BESA? Or must there be something wrong with my script? Besides this, does FT have capabilities to plot source-level data using the method 'surface' if there's no individual MRI available? This is what my script looks like: cfg = []; cfg.dataset = 'data.cnt'; cfg.trialdef.eventtype = 'trigger'; cfg.trialdef.eventvalue = 1; cfg.trialdef.prestim = 0.5; cfg.trialdef.poststim = 1; cfg = ft_definetrial(cfg); cfg.channel=1:30; cfg.demean = 'yes'; cfg.baselinewindow = [-0.1 0]; data = ft_preprocessing(cfg); avg = ft_timelockanalysis(cfg,data); vol.o = [0 0 0]; vol.c = [0.3300 1 0.0042 0.3300]; vol.r = [0.84 0.85 0.92 1]; elec = ft_read_sens('electrodes.sfp'); cfg.numdipoles = 2; cfg.symmetry = 'x'; cfg.channel = 1:30; cfg.elec = elec; cfg.vol = vol; cfg.gridsearch = 'yes'; cfg.grid.resolution = 1; cfg.model = 'regional'; cfg.latency = [0.07 0.08]; cfg.channel = 'all'; dipol = ft_dipolefitting(cfg,avg); Thanks in advance Max Taubert From r.vandermeij at donders.ru.nl Wed Apr 20 17:59:51 2011 From: r.vandermeij at donders.ru.nl (Roemer van der Meij) Date: Wed, 20 Apr 2011 11:59:51 -0400 Subject: [FieldTrip] FFT on EMG data In-Reply-To: <004701cbff48$6fe11020$4fa33060$@Rossiter@ion.ucl.ac.uk> References: <004701cbff48$6fe11020$4fa33060$@Rossiter@ion.ucl.ac.uk> Message-ID: <4DAF02F7.9090709@donders.ru.nl> Hi Holly, A few months ago we revised the entire frequency analysis module, if you download the latest version you should be fine. In the old situation, cfg.foi could only be used for method = mtmconvol, and cfg.foilim was the way to go with method = mtmfft. In the new version, you can also request specific frequencies with mtmfft using cfg.foi, next to using cfg.foilim to define a range. Note though, a cfg.foi = [5 80] (/= not cfg.foilim/) will only result in frequency estimates at 5 and 80 Hz, whereas a cfg.foilim = [5 80] would result in all possible frequencies in that range. Best, Roemer On 20-Apr-11 06:48, Holly Rossiter wrote: > > Hi, > > I am trying to run an FFT on some EMG data to obtain the peak > frequency. This is the script I am using... > > D= spm_eeg_load; > > emg = D.ftraw(0); > > cfg=[]; > > cfg.method='mtmfft'; > > cfg.output='pow'; > > cfg.taper='hanning'; > > cfg.channel={'Lforearm'}; > > cfg.foi= [5 80];% frequency band - foilim or just foi?? > > freq=ft_freqanalysis(cfg,emg); > > figure > > semilogy(freq.freq, freq.powspctrm(1,:), 'b-'); > > However, I keep getting this error... > > processing trial 1, ??? Undefined function or variable "dum". > > Error in ==> ft_freqanalysis_mtmfft at 345 > > fprintf('nfft: %d samples, taper length: %d samples, %d > > tapers\n',length(dum),size(tap,2),numtap); > > Error in ==> ft_freqanalysis at 111 > > [freq] = > > feval(sprintf('ft_freqanalysis_%s',lower(cfg.method)), cfg, > > data); > > Do you know how to fix this error? > > Thanks, > > Holly > > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip -- Roemer van der Meij M.Sc. PhD student Donders Institute for Brain, Cognition and Behaviour Centre for Cognition Radboud University Nijmegen P.O. Box 9104 6500 HE Nijmegen The Netherlands Tel: +31(0)24 3655932 E-mail: r.vandermeij at donders.ru.nl -------------- next part -------------- An HTML attachment was scrubbed... URL: From r.vandermeij at donders.ru.nl Wed Apr 20 20:16:25 2011 From: r.vandermeij at donders.ru.nl (Roemer van der Meij) Date: Wed, 20 Apr 2011 14:16:25 -0400 Subject: [FieldTrip] Changed phase convention 'wavelet' ('wltconvol') Message-ID: <4DAF22F9.4080007@donders.ru.nl> Hi everybody, We have changed the meaning of phases of /raw/ Fourier-coefficients of method = 'wavelet' (previously 'wltconvol'), so that it is in alignment with method = 'mtmconvol'. All output is now phase-shifted such that an angle of 0 of any Fourier-coefficient always means a peak of an oscillation in the data, and an angle of pi/-pi will always mean the trough of an oscillation (wavelet wise angle = 0 is implemented as cosine at peak, and sine in up-going flank) (also documented in the FAQ section here ) Processed phases, like those in a cross-spectral density array and it's children like coherence, PLVs etc., will /not /be different. You will only notice the difference if you choose cfg.output = 'fourier'. The change will be latest version on our FTP-server tonight. Best, Roemer -- Roemer van der Meij M.Sc. PhD student Donders Institute for Brain, Cognition and Behaviour Centre for Cognition Radboud University Nijmegen P.O. Box 9104 6500 HE Nijmegen The Netherlands Tel: +31(0)24 3655932 E-mail: r.vandermeij at donders.ru.nl -------------- next part -------------- An HTML attachment was scrubbed... URL: From Heng-RuMay.Tan at glasgow.ac.uk Thu Apr 21 14:27:25 2011 From: Heng-RuMay.Tan at glasgow.ac.uk (May (Heng-Ru May TAN)) Date: Thu, 21 Apr 2011 13:27:25 +0100 Subject: [FieldTrip] Question about SPM brain templates including the cerebellum Message-ID: <4DB022AD.20701@glasgow.ac.uk> Hi I was wondering if there exists within the folders of Fieldtrip, surface source-plot MRI templates which includes the cerebellum, and if not, how could one create a template which consists of the cerebellum, too? Any help would be gratefully appreciated! Thanks. May -------------- next part -------------- An HTML attachment was scrubbed... URL: From manuel.mercier at einstein.yu.edu Thu Apr 21 22:10:45 2011 From: manuel.mercier at einstein.yu.edu (Manuel Mercier) Date: Thu, 21 Apr 2011 16:10:45 -0400 Subject: [FieldTrip] Statistics (against baseline) Message-ID: <4DB08F45.2090803@einstein.yu.edu> Dear Field-trippers First of all, I would like to thank the Fieldtrip mentors, and all the contributors. I find this toolbox more than a toolbox. The website and the active mailing list makes it stimulating and definitively instructive. Which motivates me to share with you some reflections and questions. I did some statistics on data from implanted electrodes (ECoG) in human. For the purpose of this analysis, I mainly looked at the time frequency space, so I first ran the following script: (with data being the output of the /ft_preprocessing/ function) load data; trig = [3 4 5]; for cond = 1:length(trig) cfg = []; cfg.method = 'wavelet'; cfg.output = 'fourier'; cfg.foi = 2:2:50; cfg.toi = -0.5:0.02:0.05; cfg.keeptrials = 'yes'; cfg.keeptaper = 'yes'; cfg.width = 5; cfg.trials = find(data.trialinfo(:,1) == trig(cond)); TF_Mwlt_fourier{cond} = ft_freqanalysis(cfg, data); end; I used Morlet wavelet because a previous post from Robert that recommended not to use multitapering for PLF (http://mailman.science.ru.nl/pipermail/fieldtrip/2006-March/000446.html). And also to facilitate comparison with other studies. The output being Fourier, I computed power and phase concentration (aka PLF or ITC), (both calculated at single trial level for stats and then averaged for /ft_multiplot//TFR/ ) powplf_data.pow = abs(data.fourierspctrm) .^2; powplf_data.powspctrm = abs(mean(squeeze(powplf_data.pow),1)); powplf_data.plf = data.fourierspctrm./abs(data.fourierspctrm); powplf_data.plf_average = abs(mean(squeeze(powplf_data.plf),1)); The first statistics I wanted to run was a comparison of the power and the PLF for each condition against their respective baseline period. To do so I applied the following method (based on Delorme et Makeig 2004) for a given channel: - draw a value within the baseline period for each trial (independently for each time point and frequency). - average along the trial dimension - repeat those steps thousand time - use those thousand repetition to construct the distribution - count the percentage of values above (/below) the observed post-onset value from the data (at a given latency and frequency). Define significance for power using two tails (p < 0.025 & p > 0.975), and one tail for PLF (p<0.05). I decided to write my own function because I was not sure that I could do it using Field trip. I noticed that there is the /statfun_actvsblT/ that can be specified in /cfg.method/ field of /ft_freqstatistics/. But I have two concerns about it: - I prefer to used a randomization method for distribution reason. Indeed even if for power it seems to be ok with my data (seems to be normally distributed), it is by definition not the case with PLF (which is more like a gamma or F distribution; because values are more concentrated near to zero, rare value toward 1). - this function average over the specified baseline time period. This average step makes more sense to me in the case of ERP analysis, but less with time frequency. Especially with PLF, since the average will have the tendency to compress the values toward 0. I guess that an alternative would be to use /statfun_diff_itc/ with one condition being post-onset period and the other "fake" condition being the baseline. But in this case the length (duration) of the two pools should be identical, as the time points would be "paired". Am I correct about this or is it more flexible ? Here are the points I would like to discuss: 1) I think I did my analysis the correct way, but it might not be the case, so any comments about the method are very welcome. 2) when someone is interested in the phase, is there a "better" method to compute the time frequency transform? (or any method is good as long as there is no frequency smoothing) 3) can we imagine a future extra/new option in the /statfun_actvsbl/ that would allow for choosing between averaging and taking a random time point within the specified time period ? Maybe this makes less sense for T-stats than in the case of a randomization test ? and even less when this is not done at the level of single trials ? Thanks in advance for your comments. Manuel -- Manuel Mercier, PhD Research Fellow Cognitive Neurophysiology Laboratory, Children's Evaluation and Rehabilitation Center (CERC), Departments of Pediatrics Albert Einstein College of Medicine, 1225 Morris Park Avenue Bronx , New York, NY 10461 phone: +1 (718) 862 1824 fax: +1 (718) 862 1807 -------------- next part -------------- An HTML attachment was scrubbed... URL: From jan.schoffelen at donders.ru.nl Fri Apr 22 09:30:58 2011 From: jan.schoffelen at donders.ru.nl (jan-mathijs schoffelen) Date: Fri, 22 Apr 2011 09:30:58 +0200 Subject: [FieldTrip] Question about SPM brain templates including the cerebellum In-Reply-To: <4DB022AD.20701@glasgow.ac.uk> References: <4DB022AD.20701@glasgow.ac.uk> Message-ID: <79DC2E75-C97A-4DCB-B387-250F7E0B8F00@donders.ru.nl> Dear May, The surface files contain only a triangulation of the neo-cortical surface. Typically, software packages creating high-resolution meshes of the brain (such as freesurfer) exclude the cerebellum. For the figures in the famous Schoffelen et al 2008 paper (Neuroimage) I created the surfaces (with cerebellum) using a segmented template MRI (using SPM) and then, after some image processing (smoothing filling etc), called the matlab isosurface function. This gives a triangulated surface which can be used for visualization. Note that this procedure does not yield topologically a sphere, so it cannot be used for inflation. Best, Jan-Mathijs On Apr 21, 2011, at 2:27 PM, May (Heng-Ru May TAN) wrote: > Hi > > I was wondering if there exists within the folders of Fieldtrip, > surface source-plot MRI templates which includes the cerebellum, and > if not, how could one create a template which consists of the > cerebellum, too? > > Any help would be gratefully appreciated! > > Thanks. > May > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 -------------- next part -------------- An HTML attachment was scrubbed... URL: From Heng-RuMay.Tan at glasgow.ac.uk Fri Apr 22 19:39:35 2011 From: Heng-RuMay.Tan at glasgow.ac.uk (Heng-Ru May Tan) Date: Fri, 22 Apr 2011 18:39:35 +0100 Subject: [FieldTrip] Question about SPM brain templates including the cerebellum In-Reply-To: <79DC2E75-C97A-4DCB-B387-250F7E0B8F00@donders.ru.nl> References: <4DB022AD.20701@glasgow.ac.uk> <79DC2E75-C97A-4DCB-B387-250F7E0B8F00@donders.ru.nl> Message-ID: <4DB1BD57.5000803@glasgow.ac.uk> Dear Jan-Mathijs, Thank you for the sharing the information. Before trying to 're-invent the wheel', might it be possible for Fieldtrip to incorporate the famous Schoffelen et al., 2008's cerebellar-included MRI template for visualization purpose -- with the awareness that it will not permit inflation? Unless my limited knowledge on brain graphics has prevented me from appreciating the importance of 'inflation' within the Fieldtrip coding environment; in which case, I hope to be enlightened, if it is within anyone's knowledge. Also, does the 'isosurface' function preserve the MNI coordinates, if I should try to create my own template? Many thanks, again! And Happy Easter to all. May On 22/04/2011 08:30, jan-mathijs schoffelen wrote: > Dear May, > > The surface files contain only a triangulation of the neo-cortical > surface. > Typically, software packages creating high-resolution meshes of the > brain (such as freesurfer) exclude the cerebellum. > For the figures in the famous Schoffelen et al 2008 paper (Neuroimage) > I created the surfaces (with cerebellum) using a segmented template > MRI (using SPM) and then, after some image processing (smoothing > filling etc), called the matlab isosurface function. This gives a > triangulated surface which can be used for visualization. Note that > this procedure does not yield topologically a sphere, so it cannot be > used for inflation. > > Best, > > Jan-Mathijs > > On Apr 21, 2011, at 2:27 PM, May (Heng-Ru May TAN) wrote: > >> Hi >> >> I was wondering if there exists within the folders of Fieldtrip, >> surface source-plot MRI templates which includes the cerebellum, and >> if not, how could one create a template which consists of the >> cerebellum, too? >> >> Any help would be gratefully appreciated! >> >> Thanks. >> May >> >> _______________________________________________ >> fieldtrip mailing list >> fieldtrip at donders.ru.nl >> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > > Dr. J.M. (Jan-Mathijs) Schoffelen > Donders Institute for Brain, Cognition and Behaviour, > Centre for Cognitive Neuroimaging, > Radboud University Nijmegen, The Netherlands > J.Schoffelen at donders.ru.nl > Telephone: 0031-24-3614793 > > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip -------------- next part -------------- An HTML attachment was scrubbed... URL: From politzerahless at gmail.com Fri Apr 22 22:17:05 2011 From: politzerahless at gmail.com (Stephen Politzer-Ahles) Date: Fri, 22 Apr 2011 15:17:05 -0500 Subject: [FieldTrip] Data preprocessing after ICA artifact correction Message-ID: Hello everyone, I am interested in using FieldTrip to remove EOG artifact on my data before other processing. I followed the example at http://fieldtrip.fcdonders.nl/example/use_independent_component_analysis_ica_to_remove_eog_artifactsto remove EOG artifact across all conditions (that is to say, when I imported the data with ft_definetrial I imported all conditions into a single structure). After having done that, I hope to a) preprocess the data (re-reference, demean/baseline-correct, and maybe low-pass filter); b) separate the data such that the data for each condition is stored in a separate variable, so that it's ready for event-related averaging. However, it seems that I can't use ft_definetrial() and ft_preprocess() on data that I have already imported into FieldTrip and done ICA on. Does anyone have any example code for how I can do the above processing steps on the data after I have already done the ICA artifact correction in FieldTrip? Thank you very much, Steve Politzer-Ahles -- Stephen Politzer-Ahles University of Kansas Linguistics Department http://www.linguistics.ku.edu/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From lieneke.janssen at student.ru.nl Tue Apr 26 11:32:27 2011 From: lieneke.janssen at student.ru.nl (Lieneke. Janssen) Date: Tue, 26 Apr 2011 11:32:27 +0200 (CEST) Subject: [FieldTrip] preprocessing per channel Message-ID: <2008169134.446724.1303810347507.JavaMail.root@monoceros.zimbra.ru.nl> Dear Fieldtrippers, I was quite happy to find the possibility in fieldtrip to do preprocessing per channel instead of (the default) per trial. Unfortunately, if I say cfg.method = 'channel'; the output is overwritten with every channel that is preprocessed, so I end up only having the output from the last channel, whereas if the method is 'trial', the function nicely combines all preprocessed trials into the output file. Is there anything that can be done to get one preprocessing output file using cfg.method = 'channel';? Thanks! Best, Lieneke From eelke.spaak at donders.ru.nl Tue Apr 26 11:45:52 2011 From: eelke.spaak at donders.ru.nl (Eelke Spaak) Date: Tue, 26 Apr 2011 11:45:52 +0200 Subject: [FieldTrip] preprocessing per channel In-Reply-To: References: <2008169134.446724.1303810347507.JavaMail.root@monoceros.zimbra.ru.nl> Message-ID: Dear Lieneke, To be honest, I have never tried preprocessing per channel before, so I might not understand exactly what you mean by 'the output is overwritten with every channel that is preprocessed'. If so, please correct me :) The cfg.method option governs only how data is read from disk, not which parts of the data the preprocessing is applied to. If you only want to preprocess certain channels, you can use cfg.channel = {...} to specify which channels to preprocess. If you have different data sets (e.g., corresponding to different output structures from ft_preprocessing) that contain different channels (but the same trials), you can concatenate them by using ft_appenddata (http://fieldtrip.fcdonders.nl/reference/ft_appenddata). Hopefully this was somewhat helpful, Best, Eelke 2011/4/26 Lieneke. Janssen : > Dear Fieldtrippers, > > I was quite happy to find the possibility in fieldtrip to do preprocessing per channel instead of (the default) per trial. > > Unfortunately, if I say cfg.method = 'channel'; the output is overwritten with every channel that is preprocessed, so I end up only having the output from the last channel, whereas if the method is 'trial', the function nicely combines all preprocessed trials into the output file. > > Is there anything that can be done to get one preprocessing output file using cfg.method = 'channel';? > > Thanks! > > Best, > Lieneke > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > From H.Rossiter at ion.ucl.ac.uk Tue Apr 26 15:00:23 2011 From: H.Rossiter at ion.ucl.ac.uk (Holly Rossiter) Date: Tue, 26 Apr 2011 14:00:23 +0100 Subject: [FieldTrip] FFT on EMG data Message-ID: <002401cc0411$e7974f30$b6c5ed90$@Rossiter@ion.ucl.ac.uk> Hi, Downloading the newest version of Fieldtrip fixed the previous error but not I am getting another error following this script... D= spm_eeg_load; emg = D.ftraw(0); cfg=[]; cfg.method='mtmfft'; cfg.output='pow'; cfg.taper='hanning'; cfg.channel={'Lforearm'}; cfg.foilim= [5 80];% frequency band - foilim or just foi?? freq=ft_freqanalysis(cfg,emg); figure semilogy(freq.freq, freq.powspctrm(1,:), 'b-'); Error ??? Index exceeds matrix dimensions. Error in ==> ft_freqanalysis at 574 acttboi = squeeze(~isnan(spectrum(1,1,foiind(ifoi),:))); Error in ==> FFT_EMG at 15 freq=ft_freqanalysis(cfg,emg); Any advice would be much appreciated. Thanks, Holly -------------- next part -------------- An HTML attachment was scrubbed... URL: From daz at MIT.EDU Tue Apr 26 17:42:36 2011 From: daz at MIT.EDU (David Ziegler) Date: Tue, 26 Apr 2011 11:42:36 -0400 Subject: [FieldTrip] PLV/coherence on Neuromag gradiometer data Message-ID: <4DB6E7EC.8000601@mit.edu> Hi Fieldtrippers, I am interested in analyzing PLV or coherence in my MEG data from a Neuromag 306 system. In the past, for looking at power alone, I have calculated TFRs on the gradiometer data, then ran ft_combineplanar to average the gradiometer pairs. Should I use the same approach for calculating the cross-spectral density, or does this create any problems when I go to combine the results for gradiometer pairs? In particular, I am trying to wrap my head around how I would set up cfg.channelcmb if I want to look at all channel pairs, but then want to subsequently perform ft_combineplanar. (or maybe this is the wrong approach altogether?) Thanks, David -- David A. Ziegler Department of Brain and Cognitive Sciences Massachusetts Institute of Technology 43 Vassar St,46-5121 Cambridge, MA 02139 Tel: 617-258-0765 Fax: 617-253-1504 daz at mit.edu -------------- next part -------------- An HTML attachment was scrubbed... URL: From lieneke.janssen at student.ru.nl Wed Apr 27 10:55:33 2011 From: lieneke.janssen at student.ru.nl (Lieneke. Janssen) Date: Wed, 27 Apr 2011 10:55:33 +0200 (CEST) Subject: [FieldTrip] preprocessing per channel In-Reply-To: <414049370.459969.1303894250317.JavaMail.root@monoceros.zimbra.ru.nl> Message-ID: <1120852439.460085.1303894533421.JavaMail.root@monoceros.zimbra.ru.nl> Hi Eelke and others, Thanks for your reply. ft_appenddata might indeed solve my problem! It would be nice though if cfg.method would work the same for preprocessing per trial and preprocessing per channel. If cfg.method is not specified, fieldtrip assumes cfg.method = trial. It then preprocesses every trial subsequently and gives you one output file in which all subsequently preprocessed trials are present. Since I would like to preprocess my complete dataset as if one big trial as a first step, which apparently takes too much memory, I wanted to preprocess per channel (for all channels) instead of per trial. So I set cfg.method to channel. It then preprocesses every channel subsequently (as 'per trial'), but only gives you the output of the most recently processed channel (in contrary to 'per trial'). I therefore assume that output/data from the previously preprocessed channel gets lost (i.e. overwritten) when fieldtrip continues with the next channel. So unfortunately you end up with the output of the last preprocessed channel only. This does not happen for preprocessing per trial (i.e. ending up with the output of the last preprocessed trial only). I hope this problem can be solved sooner or later. Until then, I'll append my data :). Best, Lieneke ----- "Eelke Spaak" wrote: > From: "Eelke Spaak" > To: "Email discussion list for the FieldTrip project" > Sent: Tuesday, April 26, 2011 11:45:52 AM > Subject: Re: [FieldTrip] preprocessing per channel > > Dear Lieneke, > > To be honest, I have never tried preprocessing per channel before, so > I might not understand exactly what you mean by 'the output is > overwritten with every channel that is preprocessed'. If so, please > correct me :) > > The cfg.method option governs only how data is read from disk, not > which parts of the data the preprocessing is applied to. If you only > want to preprocess certain channels, you can use cfg.channel = {...} > to specify which channels to preprocess. If you have different data > sets (e.g., corresponding to different output structures from > ft_preprocessing) that contain different channels (but the same > trials), you can concatenate them by using ft_appenddata > (http://fieldtrip.fcdonders.nl/reference/ft_appenddata). > > Hopefully this was somewhat helpful, > Best, > > Eelke > > 2011/4/26 Lieneke. Janssen : > > Dear Fieldtrippers, > > > > I was quite happy to find the possibility in fieldtrip to do > preprocessing per channel instead of (the default) per trial. > > > > Unfortunately, if I say cfg.method = 'channel'; the output is > overwritten with every channel that is preprocessed, so I end up only > having the output from the last channel, whereas if the method is > 'trial', the function nicely combines all preprocessed trials into the > output file. > > > > Is there anything that can be done to get one preprocessing output > file using cfg.method = 'channel';? > > > > Thanks! > > > > Best, > > Lieneke > > _______________________________________________ > > fieldtrip mailing list > > fieldtrip at donders.ru.nl > > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > > > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip From r.oostenveld at donders.ru.nl Thu Apr 28 14:31:43 2011 From: r.oostenveld at donders.ru.nl (Robert Oostenveld) Date: Thu, 28 Apr 2011 14:31:43 +0200 Subject: [FieldTrip] change in yokogawa trigger and raw data handling Message-ID: <793850E4-B56E-4656-B755-9C8D0BCB52B9@donders.ru.nl> Dear Yokogawa users Earlier this week I made a change to the handling of Yokogawa data that might require some small updates to your analysis scripts. Let me summarise it in this mail. Although most of the meta information and header information is still read with the yokogawa p-files, the sqd data can now also be read with the sqdproject/sqdread function. As of this week the code is included in fieldtrip/external/sqdproject and will automatically be added to your path. The consequence is that much less memory is needed if you only want to read a few channels (or the trigger channels). You can now use it on a small memory computer. Another consequence is that data is expressed in fT and mV (if I am correct) and not no T and V, so please note the scaling difference. Furthermore, I have added an option to ft_read_event/read_trigger that automatically detects whether you have downgoing or upgoing flanks in the data. It used to detect both, and then it was up to you to select e.g. '169_up' as the relevant one. It will now (try to) autodetect whether your data has downgoing or upgoing flanks and only detect the triggers for the approprate one. The resulting trigger code does not have the down/up tag any more, so you should now work with '169' instead. And finally the ft_read_event function now has the 'trigindx' option documented (see also http://bugzilla.fcdonders.nl/show_bug.cgi?id=494#c2) and has an option 'threshold' for the flank detection in the analog trigger channels. best regards, Robert PS if you want to follow up to this mail with potential problems or suggestions for improvements, please use http://bugzilla.fcdonders.nl and file a "bug" for the yokogawa component. From jan.schoffelen at donders.ru.nl Fri Apr 29 12:30:13 2011 From: jan.schoffelen at donders.ru.nl (jan-mathijs schoffelen) Date: Fri, 29 Apr 2011 12:30:13 +0200 Subject: [FieldTrip] change in scaling of sine tapers Message-ID: <8E52B0AC-BA08-4B45-8CB1-89005BAE2851@donders.ru.nl> Dear all, I made a change to how ft_freqanalysis scales the tapers when cfg.taper has been specified to be 'sine'. This has been done to make the handling of this type of taper consistent with the other (multi) tapers. Each of the tapers used has now a norm of 1, which makes the scale of the powerspectrum of the tapered time series consistent across different tapers. Initially, this was not the case for the sine taper. For backward compatibility I implemented the (we think less appropriate) scaled version. In order to use the scaled sine tapers, you need to specify cfg.taper = 'sine_old' prior to calling ft_freqanalysis. Best wishes, Jan-Mathijs Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 From a.wollbrink at uni-muenster.de Fri Apr 1 16:37:45 2011 From: a.wollbrink at uni-muenster.de (Andreas Wollbrink) Date: Fri, 01 Apr 2011 16:37:45 +0200 Subject: [FieldTrip] Dipole time course In-Reply-To: <2E7764CB-846C-4A40-A4FB-7F6C3376C465@ucdenver.edu> References: <722089035bbba.4d93df8a@mail.uh.edu> <0A4E2DDD-B79F-4B96-A777-CB880E117016@donders.ru.nl> <2E7764CB-846C-4A40-A4FB-7F6C3376C465@ucdenver.edu> Message-ID: <4D95E339.6070604@uni-muenster.de> Hi Don, I just tried out your approach on how to achieve the source waveform based on a given dipole source but failed calculating the scalar product of the inverse leadfield matrix and the normed orientation vector: W = dot(Li,Qn); error message: A and B must be same size. May I ask you for a suggestion? Best, Andreas On 03/31/11 17:57, Rojas, Don wrote: > Mehmet et al. > > As a follow up to this, once you have the orientation info from the > dipole, the source space projection you wish to achieve to derive the > timecourse can be done as follows (or at least something similar to > this), assuming you have the fieldtrip data (data) the source, and the > volume conductor (vol): > > L = ft_compute_leadfield(source.dip.pos, data.grad,vol); % leadfields > Li = pinv(L); % pseudoinverse of L > Qn = double(orientation_vector)/norm(orientation_vector); % normed > orientation vector > W = dot(Li,Qn); % weights for projection to source space > waveform = dot(data,repmat(W',1,length(data))); % source waveform > > where the orientation_vector is a 1 x 3 vector of qx, qy and qz. This > can be had from one of your sources from source.dip.mom, or from the > suggestion of Jan-Mathijs. I don't know if the data you have is an > average that you want to project into source space or individual trials. > If you want to do this with the individual trials, you'd just need to do > the last piece of code above as a for loop through your trials - you > don't have to recompute the weights (W) used for the projection. > > Best, > > Don > > On Mar 31, 2011, at 1:38 AM, jan-mathijs schoffelen wrote: > >> Hi Mehmet, >> >> I forward this to the mailing list, so that people can participate in >> the thread. >> >> I do not fully understand where the orientation information in the vol >> comes from. The description of the volume conductor is namely a >> geometrical object, containing either a (set of) triangulated >> surface(s), to describe compartment boundaries, or the description of >> a (set of) sphere(s), with an origin and a radius. >> The outcome of the dipolefitting algorithm gives you a field, called >> dip.mom, describing the dipole moment as a function of time. At each >> time point, the three numbers reflect the instantaneous orientation of >> the dipole. Since you are working with MEG, I assume that the >> orientation of this dipole is actually defined on a plane, because we >> routinely suppress the component with the most radial orientation from >> the leadfield. One way of reducing the dimension is to check whether >> there is a single dominant orientation over time. This can be achieved >> by doing a pca (or svd) of dip.mom. The ratio of the first two >> singular values specifies how well the dipole can be approximated as >> one having a fixed orientation. The left singular vectors give you the >> projection vectors, and thus specify the orientation. In other words >> [u,s,v] = svd(dip.mom). if s(1,1) >> s(2,2), one could justify to use >> u(:,1) as the 'orientation' of the corresponding dipole. >> >> Best, >> >> Jan-Mathijs >> >> >> >> >> >> Begin forwarded message: >> >>> *From: *Mehmet-Akif Coskun >> > >>> *Date: *March 31, 2011 8:57:30 AM GMT+02:00 >>> *To: *jan-mathijs schoffelen >> > >>> *Subject: **Dipole time course* >>> >>> Hi Jan, >>> Thanks for all your help. I am really close to get the dipole time courses. Everything looks fine in terms of reading data, preprocessing, creating headmodel and fitting a dipole. The last part is to obtain a dipole time course. >>> >>> I actually read through the previous emails in discussion list and followed the advices. I used the code below to obtain the leadfield and then project the pinv'ed leadfield onto ERF to get the dipole course. But the leadfield is 3D so i get 3 time courses. >>> % prepare leadfield cfg=[]; cfg.grad= hdr.grad; cfg.vol=vol; cfg.channel='MEG'; cfg.grid.pos=dipM50.dip.pos; >>> [grid_ft_segment2]=ft_prepare_leadfield(cfg); >>> >>> In the email below, you suggested to an other user to multiply the 3D leadfields with the orientation estimated by the dipole fit. I checked the outcome of the dipole but there wasn't any orientation information. However, i checked the vol structure which has the orientation and multiply 3D leadfields with vol.ori and then project 1d leadfield onto ERF. I got a nice looking time course. I just wonder whether what i did is meaningful. >>> >>> Thanks >>> Mehmet >>> >>> P.S= Below is your previous email >>> I suspect that the 'orientation' onto which the pca projects the dipoles is not optimal. Perhaps you might want to try the other way, i.e. compute the leadfields in 1D, either by specifying something in cfg.grid.mom (or ori, I keep forgetting) before calling prepare_leadfield, or by postmultiplying the 3D leadfields with the orientation as estimated by the dipole fit. >> >> Dr. J.M. (Jan-Mathijs) Schoffelen >> Donders Institute for Brain, Cognition and Behaviour, >> Centre for Cognitive Neuroimaging, >> Radboud University Nijmegen, The Netherlands >> J.Schoffelen at donders.ru.nl >> Telephone: 0031-24-3614793 >> >> _______________________________________________ >> fieldtrip mailing list >> fieldtrip at donders.ru.nl >> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > > ----------------------- > Don Rojas, Ph.D. > Associate Professor of Psychiatry > U. of Colorado Denver Anschutz Medical Campus > Director, UCD Magnetoencephalography Lab > 13001 E. 17th Pl F546 > Aurora, CO 80045 > 303-724-4994 > > > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip -- ====================================================================== Andreas Wollbrink, Biomedical Engineer Institute for Biomagnetism and Biosignalanalysis Muenster University Hospital Malmedyweg 15 phone: +49-(0)251-83-52546 D-48149 Muenster mobil: +49-(0)160-98527553 Germany fax: +49-(0)251-83-56874 e-Mail: a.wollbrink at uni-muenster.de ====================================================================== From Don.Rojas at ucdenver.edu Fri Apr 1 20:15:00 2011 From: Don.Rojas at ucdenver.edu (Rojas, Don) Date: Fri, 1 Apr 2011 12:15:00 -0600 Subject: [FieldTrip] Dipole time course In-Reply-To: <1F405F51-C58D-446B-A2F2-2EBD3ACBB908@ucdenver.edu> References: <722089035bbba.4d93df8a@mail.uh.edu> <0A4E2DDD-B79F-4B96-A777-CB880E117016@donders.ru.nl> <2E7764CB-846C-4A40-A4FB-7F6C3376C465@ucdenver.edu> <4D95E339.6070604@uni-muenster.de> <1F405F51-C58D-446B-A2F2-2EBD3ACBB908@ucdenver.edu> Message-ID: Andreas, I just wrote that code snippet from memory so it figures it wouldn't work without a little clean up. I forgot what the dimensions would be of the Li and Qn variables and the dot operation has to have arrays of the same size as input. I tested an example and this correction should work for you. I also corrected a parenthetic error on the use of double in the Qn line that would not have generated an error. I added a couple of transposes here and there. But, check your sizes as follows if you have problems - often, something will just need to be transposed to get it into the proper shape. I added some info on each input and variable to hopefully clarify what I'm after in the example: source.dip.pos: 1 x 3 orientation_vector: 1 x 3 (Fieldtrip source structure orientation is 3 x 1 per dipole, so probably need to transpose if getting from source structure) L: nchannels x 3 Li: 3 x nchannels; Qn: 1 x 3, then 3 x nchannels after repmat() W: 1 x nchannels waveform: 1 x nsamples data: Fieldtrip timelock structure with avg field data.avg: nchannels x nsamples vol: volume conductor in Fieldtrip - I coded this with a single sphere model source: source output from ft_dipolefitting() Revised code example: L = ft_compute_leadfield(source.dip.pos, data.grad,vol,'reducerank',2); % leadfield Li = pinv(L); % pseudoinverse of L Qn = double(orientation_vector/norm(orientation_vector)); % normed orientation vector Qn = repmat(Qn,length(Li),1)'; % make Qn the same size as Li W = dot(Li,Qn)'; % weights for projection to source space waveform = dot(data.avg,repmat(W,1,size(data.avg,2))); % source waveform Hope that helps. I'm thinking that if your gradiometer data scaling is in meters (check your grad structure) and the input data scaling to the last dot operation is in fT, then your output scale will be A-m (1e-9), but you might want to check since I didn't confirm that. I think by default the fieldtrip MEG data are in units of T so you might need to scale your input data accordingly to get your desired output scale. But then, I'm assuming MEG gradiometer data input, so if you have something else, check your function call to ft_compute_leadfield and adjust your scaling accordingly. Don On Apr 1, 2011, at 8:37 AM, Andreas Wollbrink wrote: > Hi Don, > > I just tried out your approach on how to achieve the source waveform > based on a given dipole source but failed calculating the scalar product > of the inverse leadfield matrix and the normed orientation vector: > > W = dot(Li,Qn); > > error message: A and B must be same size. > > May I ask you for a suggestion? > > Best, > Andreas > From a.wollbrink at uni-muenster.de Mon Apr 4 15:51:26 2011 From: a.wollbrink at uni-muenster.de (Andreas Wollbrink) Date: Mon, 04 Apr 2011 15:51:26 +0200 Subject: [FieldTrip] Dipole time course In-Reply-To: References: <722089035bbba.4d93df8a@mail.uh.edu> <0A4E2DDD-B79F-4B96-A777-CB880E117016@donders.ru.nl> <2E7764CB-846C-4A40-A4FB-7F6C3376C465@ucdenver.edu> <4D95E339.6070604@uni-muenster.de> <1F405F51-C58D-446B-A2F2-2EBD3ACBB908@ucdenver.edu> Message-ID: <4D99CCDE.6000407@uni-muenster.de> Hi Don, thanks for your advices. I succeeded calculating the source waveform time series using your modified script lines. Since the number of sensors in the data.grad field was different from the number of channels in the data.avg matrix I added the following line to the beginning of your code: [vol, grad] = ft_prepare_vol_sens(vol, avgData.grad, 'channel', avgData.label); I am using data recorded with the 275 channel axial gradiometer VSM system. During the recording 3 channels were defined as bad. The noise balancing was set to 1 (first order synthetic gradiometers). Using ft_preprocessing and ft_timelockanalysis with the the setting cfg.channel = 'MEG' one ends up with 272 channels in the data.avg matrix and 281 sensors in the cfg.grad structure. Since I am not sure whether it is correct to apply the ft_prepare_vol_sens function in the way I did it I would appreciate if an expert could comment on that. Andreas On 04/01/11 20:15, Rojas, Don wrote: > Andreas, > > I just wrote that code snippet from memory so it figures it wouldn't work without a little clean up. I forgot what the dimensions would be of the Li and Qn variables and the dot operation has to have arrays of the same size as input. I tested an example and this correction should work for you. I also corrected a parenthetic error on the use of double in the Qn line that would not have generated an error. I added a couple of transposes here and there. But, check your sizes as follows if you have problems - often, something will just need to be transposed to get it into the proper shape. I added some info on each input and variable to hopefully clarify what I'm after in the example: > > source.dip.pos: 1 x 3 > orientation_vector: 1 x 3 (Fieldtrip source structure orientation is 3 x 1 per dipole, so probably need to transpose if getting from source structure) > L: nchannels x 3 > Li: 3 x nchannels; > Qn: 1 x 3, then 3 x nchannels after repmat() > W: 1 x nchannels > waveform: 1 x nsamples > data: Fieldtrip timelock structure with avg field > data.avg: nchannels x nsamples > vol: volume conductor in Fieldtrip - I coded this with a single sphere model > source: source output from ft_dipolefitting() > > Revised code example: > > L = ft_compute_leadfield(source.dip.pos, data.grad,vol,'reducerank',2); % leadfield > Li = pinv(L); % pseudoinverse of L > Qn = double(orientation_vector/norm(orientation_vector)); % normed orientation vector > Qn = repmat(Qn,length(Li),1)'; % make Qn the same size as Li > W = dot(Li,Qn)'; % weights for projection to source space > waveform = dot(data.avg,repmat(W,1,size(data.avg,2))); % source waveform > > Hope that helps. I'm thinking that if your gradiometer data scaling is in meters (check your grad structure) and the input data scaling to the last dot operation is in fT, then your output scale will be A-m (1e-9), but you might want to check since I didn't confirm that. I think by default the fieldtrip MEG data are in units of T so you might need to scale your input data accordingly to get your desired output scale. But then, I'm assuming MEG gradiometer data input, so if you have something else, check your function call to ft_compute_leadfield and adjust your scaling accordingly. > > Don > > On Apr 1, 2011, at 8:37 AM, Andreas Wollbrink wrote: > >> Hi Don, >> >> I just tried out your approach on how to achieve the source waveform >> based on a given dipole source but failed calculating the scalar product >> of the inverse leadfield matrix and the normed orientation vector: >> >> W = dot(Li,Qn); >> >> error message: A and B must be same size. >> >> May I ask you for a suggestion? >> >> Best, >> Andreas >> > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip -- ====================================================================== Andreas Wollbrink, Biomedical Engineer Institute for Biomagnetism and Biosignalanalysis Muenster University Hospital Malmedyweg 15 phone: +49-(0)251-83-52546 D-48149 Muenster mobil: +49-(0)160-98527553 Germany fax: +49-(0)251-83-56874 e-Mail: a.wollbrink at uni-muenster.de ====================================================================== From recasensmarc at gmail.com Tue Apr 5 18:54:01 2011 From: recasensmarc at gmail.com (Marc Recasens) Date: Tue, 5 Apr 2011 18:54:01 +0200 Subject: [FieldTrip] Source reconstruction and NAI Message-ID: Dear all, As far as I know it is possible to reconstruct the time-course of the sources (obtained using sourceanalysis) by projecting/multiplying the filter-weights on the data. In my case, the specific code I am using is: for i=1:nvoxels(inside) for tr=1:ntrials ts(tr,:)=(source.avg.ori{source.inside(i)}(1,:)*source.avg.filter{source.inside(i)}*data2{condit}.trial{tr}); end datvx(i,:,:)= single_trial_time_course end I used a common filter with 3 different conditions, thus I think this is the only way I have to reconstruct the activity for one of the conditions. My Question is about how to apply the NAI normalization here. Can I just divide the output of the source reconstruction by the projected noise of the filter? I am tempted to do something like that datvx(i,:,:)= single_trial_time_course ./ repmat(noise(inside),[size(ts,1), size(ts,2)] That is, I divide the power by the noise estimate (for each voxel) in every trial and time-point. Could anyone tell me whether this is a correct way to procedure? Any other workaround? Thanks in advance! -- Marc Recasens Tel.: +34 639 24 15 98 -------------- next part -------------- An HTML attachment was scrubbed... URL: From nathanweisz at mac.com Thu Apr 7 11:31:35 2011 From: nathanweisz at mac.com (Nathan Weisz) Date: Thu, 07 Apr 2011 11:31:35 +0200 Subject: [FieldTrip] cfg.latency and ft_timelockanalysis Message-ID: <934EFFDB-DED1-4F8C-BE1F-9F7AC2D9B447@mac.com> hi, i just noticed that the option cfg.latency has been deprecated from ft_timelockanalysis. does this have a specific reason? seems to be done on purpose :-) i am asking because i always thought that it was a nice feature when later using beamformer analysis (lcmv) to have a more narrow window to calculate e.g. power (using ft_sourcedescriptives) or to orient sources when later applying filters to raw data, and to have a wider window including also prestim periods for covariance estimation. of course the workaround is to run two timelocks with a redefinetrial in between. but it appears rather awkward. thanks for any input, nathan From s.mohr at psy.gla.ac.uk Thu Apr 7 12:55:04 2011 From: s.mohr at psy.gla.ac.uk (sibylle) Date: Thu, 7 Apr 2011 11:55:04 +0100 Subject: [FieldTrip] plv and sourceanalysis Message-ID: <0EA26325-41FA-4669-A95D-A643F2D8F84F@psy.gla.ac.uk> Dear Fieldtrippers, I have a couple of question and I hope someone can help me: How is it possible to compute plv (for freq data)? As far as I can remember there used to be an option within ft_sourcedescriptives, which seems to have disappeared. How can one use plv to determine connectivity in source space? Thanks a lot & best wishes, Sibylle From sklein at berkeley.edu Thu Apr 7 13:09:46 2011 From: sklein at berkeley.edu (Stanley Klein) Date: Thu, 7 Apr 2011 04:09:46 -0700 Subject: [FieldTrip] plv and sourceanalysis In-Reply-To: <0EA26325-41FA-4669-A95D-A643F2D8F84F@psy.gla.ac.uk> References: <0EA26325-41FA-4669-A95D-A643F2D8F84F@psy.gla.ac.uk> Message-ID: Speaking of plv, two weeks ago I sent out a question regarding plv, but I don't recall getting any responses. My questions were: 1) By ignoring the phasor magnitudes when summing over trials, isn't plv noisier than standard coherence that includes magnitudes? 2) By including the real part isn't plv often dominated by volume conduction that can be avoided by just looking at the imaginary part of coherence (sadly the imaginary part may be hard to interpret and it ignores the non-volume conducting contributions to the real part). My original posting included: *"I recall that when Lachaux et al. (1999) introduced it (I think it was them) I didn't understand what is the advantage of adding unit magnitude phasors. I would have thought that neglecting the magnitude of the phasor would give a noisier measure of coherence. Another worry is that the PLV includes the real part of the phasor which is contaminated by the volume conduction from the forward model. To avoid that contamination many people only look at the imaginary part (the aspect of PLV with 90 deg phase shift). The problem with the imaginary part is that one loses the information from the non-volume conduction real part."* thanks, Stan On Thu, Apr 7, 2011 at 3:55 AM, sibylle wrote: > Dear Fieldtrippers, > > I have a couple of question and I hope someone can help me: > How is it possible to compute plv (for freq data)? > As far as I can remember there used to be an option within > ft_sourcedescriptives, which seems to have disappeared. > How can one use plv to determine connectivity in source space? > > Thanks a lot & best wishes, > > Sibylle > > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jan.schoffelen at donders.ru.nl Thu Apr 7 14:14:10 2011 From: jan.schoffelen at donders.ru.nl (jan-mathijs schoffelen) Date: Thu, 7 Apr 2011 14:14:10 +0200 Subject: [FieldTrip] cfg.latency and ft_timelockanalysis In-Reply-To: <934EFFDB-DED1-4F8C-BE1F-9F7AC2D9B447@mac.com> References: <934EFFDB-DED1-4F8C-BE1F-9F7AC2D9B447@mac.com> Message-ID: Hi Nathan, Yes, we thought long and deep about this, and we concluded that cfg.latency was to be kicked out as an option. We had the impression that the old-style cfg options were a bit confusing and counter- intuitive. First of all, apologies that we did not communicate this change more clearly, we kind of assumed that hardly anyone used this option anyway. This is our take on it: If you use ft_timelockanalysis in order to compute a covariance to be used in ft_sourceanalysis, cfg.covariancewindow is the option that specifies the latency for the covariance. A call to ft_timelockanalysis will then give you the event-related field for free, but the latency of this ERF is not anymore confined (which was previously done by cfg.latency). What we thought was confusing (and potentially unwanted), is that the user could specify totally different windows for the covariance computation and for the latency, which could lead to the spatial filters being optimized for a stretch of data totally different from the source-reconstructed data the user would be looking at after the call to ft_sourceanalysis. It is the covariancewindow that eventually determines the shape of the spatial filters and the idea was that one could just as well project the whole ERF through the spatial filters and apply latency constraints later on, if necessary. This functionality (i.e. the application of latency constraints is not yet fully operational, but we're working on it). If the user would like to do some fancy stuff (which you seem to like ;o) ) we'd rather make it explicit that ft_sourceanalysis needs to be run twice (in the first round obviously with cfg.keepfilter = 'yes'), instead of running the risk that the user doesn't fully obtain what he/she asked for. Obviously, the scenario you sketch is perfectly valid and we understand that you like it to still be supported. We however hope that you appreciate the fact that we trust our expert users to take this little inconvenience for granted at the benefit of more transparent code and less trouble for the novice users. Best wishes, Jan-Mathijs On Apr 7, 2011, at 11:31 AM, Nathan Weisz wrote: > hi, > > i just noticed that the option cfg.latency has been deprecated from > ft_timelockanalysis. > > does this have a specific reason? seems to be done on purpose :-) > > i am asking because i always thought that it was a nice feature when > later using beamformer analysis (lcmv) to have a more narrow window > to calculate e.g. power (using ft_sourcedescriptives) or to orient > sources when later applying filters to raw data, and to have a wider > window including also prestim periods for covariance estimation. > > of course the workaround is to run two timelocks with a > redefinetrial in between. but it appears rather awkward. > > thanks for any input, > nathan > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 From jan.schoffelen at donders.ru.nl Thu Apr 7 14:23:58 2011 From: jan.schoffelen at donders.ru.nl (jan-mathijs schoffelen) Date: Thu, 7 Apr 2011 14:23:58 +0200 Subject: [FieldTrip] Source reconstruction and NAI In-Reply-To: References: Message-ID: Dear Marc, It seems from your question that you are interested in single trial reconstructed time series. If your purpose is to do a statistical comparison across a set of conditions I would not do a noise normalization at all. You mention that you used a spatial filter common to the three conditions. As a consequence, the estimate of the noise will be independent of the condition, so any normalization you would apply just leads to a scaling of the data, and will not change the outcome of your statistical test. Yet, I understand that it sometimes makes sense to do a normalization in order to be able to make a sensible visualization of the data (i.e. removing the big central blob). Also, in this case I would compute a descriptive statistic across the conditions, rather than normalizing with an estimate of the projected noise (which in FieldTrip is rather rudimentary because it assumes the noise to be spatially white). You could for example compute an F-value from a one-factor, three level anova, or do a pairwise comparison of conditions using a t-test. Another alternative (which does not affect your statistical test either), is to work with norm-normalized leadfields. This will take away the blob in the centre of the volume, and facilitates visualization. Best wishes, Ja-Mathijs On Apr 5, 2011, at 6:54 PM, Marc Recasens wrote: > Dear all, > > As far as I know it is possible to reconstruct the time-course of > the sources (obtained using sourceanalysis) by projecting/ > multiplying the filter-weights on the data. > In my case, the specific code I am using is: > for i=1:nvoxels(inside) > > for tr=1:ntrials > > ts(tr,:)=(source.avg.ori{source.inside(i)} > (1,:)*source.avg.filter{source.inside(i)}*data2{condit}.trial{tr}); > > end > > datvx(i,:,:)= single_trial_time_course > > end > > I used a common filter with 3 different conditions, thus I think > this is the only way I have to reconstruct the activity for one of > the conditions. > My Question is about how to apply the NAI normalization here. Can I > just divide the output of the source reconstruction by the projected > noise of the filter? I am tempted to do something like that > > datvx(i,:,:)= single_trial_time_course ./ repmat(noise(inside), > [size(ts,1), size(ts,2)] > > That is, I divide the power by the noise estimate (for each voxel) > in every trial and time-point. Could anyone tell me whether this is > a correct way to procedure? Any other workaround? > > > > Thanks in advance! > > -- > Marc Recasens > Tel.: +34 639 24 15 98 > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 -------------- next part -------------- An HTML attachment was scrubbed... URL: From jan.schoffelen at donders.ru.nl Thu Apr 7 14:28:18 2011 From: jan.schoffelen at donders.ru.nl (jan-mathijs schoffelen) Date: Thu, 7 Apr 2011 14:28:18 +0200 Subject: [FieldTrip] plv and sourceanalysis In-Reply-To: <0EA26325-41FA-4669-A95D-A643F2D8F84F@psy.gla.ac.uk> References: <0EA26325-41FA-4669-A95D-A643F2D8F84F@psy.gla.ac.uk> Message-ID: <6ADFF688-0149-4940-9F99-C83741BD5308@donders.ru.nl> Dear Sibylle, You confuse me a bit. You mention ft_sourcedescriptives in combination with freq data. Do you mean that you have source-level data in the frequency domain, or do you have freq-data, as in sensor level data having been processed by ft_freqanalysis? In the former case, I do not recall that ft_sourcedescriptives could compute a plv. In the latter case: it was indeed supported by ft_freqdescriptives. A while ago we moved the functionality of ft_freqdescriptives dealing with coherence/plv etc to ft_connectivityanalysis. So I'd suggest to have a look there. Also, I think it should be possible to use ft_connectivityanalysis to compute source level plv, but this may still need some tweaking. Best wishes, Jan-Mathijs On Apr 7, 2011, at 12:55 PM, sibylle wrote: > Dear Fieldtrippers, > > I have a couple of question and I hope someone can help me: > How is it possible to compute plv (for freq data)? > As far as I can remember there used to be an option within > ft_sourcedescriptives, which seems to have disappeared. > How can one use plv to determine connectivity in source space? > > Thanks a lot & best wishes, > > Sibylle > > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 From jan.schoffelen at donders.ru.nl Thu Apr 7 14:29:54 2011 From: jan.schoffelen at donders.ru.nl (jan-mathijs schoffelen) Date: Thu, 7 Apr 2011 14:29:54 +0200 Subject: [FieldTrip] plv and sourceanalysis In-Reply-To: References: <0EA26325-41FA-4669-A95D-A643F2D8F84F@psy.gla.ac.uk> Message-ID: <5AADFF53-1C6A-4541-A21E-DF462587EB20@donders.ru.nl> Dear Stan, Here is my take on it: > Speaking of plv, two weeks ago I sent out a question regarding plv, > but I don't recall getting any responses. My questions were: > > 1) By ignoring the phasor magnitudes when summing over trials, isn't > plv noisier than standard coherence that includes magnitudes? > Yes > 2) By including the real part isn't plv often dominated by volume > conduction that can be avoided by just looking at the imaginary part > of coherence (sadly the imaginary part may be hard to interpret and > it ignores the non-volume conducting contributions to the real part). I agree. What's the question here? Best wishes, Jan-Mathijs From Gregor.Volberg at psychologie.uni-regensburg.de Thu Apr 7 15:10:05 2011 From: Gregor.Volberg at psychologie.uni-regensburg.de (Gregor Volberg) Date: Thu, 07 Apr 2011 15:10:05 +0200 Subject: [FieldTrip] Antw: plv and sourceanalysis In-Reply-To: <0EA26325-41FA-4669-A95D-A643F2D8F84F@psy.gla.ac.uk> References: <0EA26325-41FA-4669-A95D-A643F2D8F84F@psy.gla.ac.uk> Message-ID: <4D9DD3CD0200005700008F9F@gwsmtp1.uni-regensburg.de> Dear Sybille, the plv option is now within ft_connectivityanalysis. I was successful with the code given below (ft_freqanalysis changed a bit in newer versions of fieldtrip so there might be some small corrections necessary). As much as I know, a plv analysis on source activity is not implemented as one of fieldtrip's high-level functions, but could be done by hand. One possibility is to use source analysis to identify regions of interest, which can then be used as "virtual electrodes" for ft_freqanalysis and ft_connectivityanalysis, just as the real electrodes in sensor space data. In order for that to work, you need to reconstruct single trial source activity at your ROIs. How this is done depends on the method you use for source analysis. There are some recent postings where a method is described for an LCMV beamformer. Hope this helps, Gregor cfg_tfr = []; cfg_tfr.output = 'fourier'; cfg_tfr.channel = 'all'; cfg_tfr.method = 'mtmconvol' cfg_tfr.taper = 'hanning' cfg_tfr.toi = -0.6:0.02:1 cfg_tfr.foi = [8 9 10 11 12]; cfg_tfr.t_ftimwin = 7./cfg_tfr.foi; cfg_tfr.channelcmb = {'EEG', 'EEG'} freq_output = ft_freqanalysis(cfg_tfr,data); cfg_con = []; cfg_con.method = 'plv'; plv = ft_connectivityanalysis(cfg_con, freq_output); -- Dr. rer. nat. Gregor Volberg ( mailto:gregor.volberg at psychologie.uni-regensburg.de ) University of Regensburg Institute for Experimental Psychology 93040 Regensburg, Germany Tel: +49 941 943 3862 Fax: +49 941 943 3233 http://www.psychologie.uni-regensburg.de/Greenlee/team/volberg/volberg.html >>> sibylle 4/7/2011 12:55 PM >>> Dear Fieldtrippers, I have a couple of question and I hope someone can help me: How is it possible to compute plv (for freq data)? As far as I can remember there used to be an option within ft_sourcedescriptives, which seems to have disappeared. How can one use plv to determine connectivity in source space? Thanks a lot & best wishes, Sibylle _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip -------------- next part -------------- An HTML attachment was scrubbed... URL: From grigu at cbs.mpg.de Thu Apr 7 15:19:17 2011 From: grigu at cbs.mpg.de (Maren Grigutsch) Date: Thu, 07 Apr 2011 15:19:17 +0200 Subject: [FieldTrip] plv and sourceanalysis In-Reply-To: <5AADFF53-1C6A-4541-A21E-DF462587EB20@donders.ru.nl> References: <0EA26325-41FA-4669-A95D-A643F2D8F84F@psy.gla.ac.uk> <5AADFF53-1C6A-4541-A21E-DF462587EB20@donders.ru.nl> Message-ID: <4D9DB9D5.1000000@cbs.mpg.de> jan-mathijs schoffelen wrote: > Dear Stan, > > Here is my take on it: > >> Speaking of plv, two weeks ago I sent out a question regarding plv, >> but I don't recall getting any responses. My questions were: >> >> 1) By ignoring the phasor magnitudes when summing over trials, isn't >> plv noisier than standard coherence that includes magnitudes? >> > > Yes Yes, if your signals are coherent. But I would not say that plv and coherence are just two different measures for the same thing. There exist dynamic regimes where only the phases of oscillators are coupled and the amplitudes are not. This type of coupling can be detected by measuring plv but not by computing coherence. > > >> 2) By including the real part isn't plv often dominated by volume >> conduction that can be avoided by just looking at the imaginary part >> of coherence (sadly the imaginary part may be hard to interpret and >> it ignores the non-volume conducting contributions to the real part). > > I agree. What's the question here? > > Best wishes, > > Jan-Mathijs > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip -- Max Planck Institute for Human Cognitive and Brain Sciences Dipl.-Phys. Maren Grigutsch mailto:grigu at cbs.mpg.de Stephanstr.1a http://www.cbs.mpg.de 04103 Leipzig, Germany phone/fax: +49 341 9940-136/-2260 From s.mohr at psy.gla.ac.uk Thu Apr 7 16:10:12 2011 From: s.mohr at psy.gla.ac.uk (sibylle) Date: Thu, 7 Apr 2011 15:10:12 +0100 Subject: [FieldTrip] plv and sourceanalysis In-Reply-To: <6ADFF688-0149-4940-9F99-C83741BD5308@donders.ru.nl> References: <0EA26325-41FA-4669-A95D-A643F2D8F84F@psy.gla.ac.uk> <6ADFF688-0149-4940-9F99-C83741BD5308@donders.ru.nl> Message-ID: <2F46431A-C0AF-4165-BC4E-E0F36B16A1A4@psy.gla.ac.uk> Dear Jan-Mathijs, Yes indeed, it is freq-data (preprocessed by ft_freqanalysis). Apologies for the confusion. Subsequently, we localized the effects using ft_sourceanalysis (cfg.method = 'dics') and identified regions of interest, which I'd like to use now for the connectivityanalysis I assume in order to use plv I would need to run ft_connectivityanalysis at the freq-level. Anyway, thanks a lot for your help! I will have a look at the ft_connectivityanalysis options. Thanks again & best wishes, Sibylle On 7 Apr 2011, at 13:28, jan-mathijs schoffelen wrote: > Dear Sibylle, > > You confuse me a bit. You mention ft_sourcedescriptives in > combination with freq data. Do you mean that you have source-level > data in the frequency domain, or do you have freq-data, as in sensor > level data having been processed by ft_freqanalysis? In the former > case, I do not recall that ft_sourcedescriptives could compute a > plv. In the latter case: it was indeed supported by > ft_freqdescriptives. > A while ago we moved the functionality of ft_freqdescriptives > dealing with coherence/plv etc to ft_connectivityanalysis. So I'd > suggest to have a look there. Also, I think it should be possible to > use ft_connectivityanalysis to compute source level plv, but this > may still need some tweaking. > > Best wishes, > > Jan-Mathijs > > > On Apr 7, 2011, at 12:55 PM, sibylle wrote: > >> Dear Fieldtrippers, >> >> I have a couple of question and I hope someone can help me: >> How is it possible to compute plv (for freq data)? >> As far as I can remember there used to be an option within >> ft_sourcedescriptives, which seems to have disappeared. >> How can one use plv to determine connectivity in source space? >> >> Thanks a lot & best wishes, >> >> Sibylle >> >> >> _______________________________________________ >> fieldtrip mailing list >> fieldtrip at donders.ru.nl >> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > > Dr. J.M. (Jan-Mathijs) Schoffelen > Donders Institute for Brain, Cognition and Behaviour, > Centre for Cognitive Neuroimaging, > Radboud University Nijmegen, The Netherlands > J.Schoffelen at donders.ru.nl > Telephone: 0031-24-3614793 > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip -------------- next part -------------- An HTML attachment was scrubbed... URL: From s.mohr at psy.gla.ac.uk Thu Apr 7 16:20:23 2011 From: s.mohr at psy.gla.ac.uk (sibylle) Date: Thu, 7 Apr 2011 15:20:23 +0100 Subject: [FieldTrip] Antw: plv and sourceanalysis In-Reply-To: <4D9DD3CD0200005700008F9F@gwsmtp1.uni-regensburg.de> References: <0EA26325-41FA-4669-A95D-A643F2D8F84F@psy.gla.ac.uk> <4D9DD3CD0200005700008F9F@gwsmtp1.uni-regensburg.de> Message-ID: Dear Gregor, I think that is exactly what I was looking for! Thanks a lot for your fast reply, this is really helpful :) Actually, I already ran ft_sourceanalysis (using DICS) to identify regions of interest. I will have a look at the LCMV beamformer postings you've recommended. Best wishes, Sibylle On 7 Apr 2011, at 14:10, Gregor Volberg wrote: > Dear Sybille, > > the plv option is now within ft_connectivityanalysis. I was > successful with the code given below (ft_freqanalysis changed a bit > in newer versions of fieldtrip so there might be some small > corrections necessary). As much as I know, a plv analysis on source > activity is not implemented as one of fieldtrip's high-level > functions, but could be done by hand. One possibility is to use > source analysis to identify regions of interest, which can then be > used as "virtual electrodes" for ft_freqanalysis and > ft_connectivityanalysis, just as the real electrodes in sensor space > data. In order for that to work, you need to reconstruct single > trial source activity at your ROIs. How this is done depends on the > method you use for source analysis. There are some recent postings > where a method is described for an LCMV beamformer. > Hope this helps, > Gregor > > > cfg_tfr = []; > cfg_tfr.output = 'fourier'; > cfg_tfr.channel = 'all'; > cfg_tfr.method = 'mtmconvol' > cfg_tfr.taper = 'hanning' > cfg_tfr.toi = -0.6:0.02:1 > cfg_tfr.foi = [8 9 10 11 12]; > cfg_tfr.t_ftimwin = 7./cfg_tfr.foi; > cfg_tfr.channelcmb = {'EEG', 'EEG'} > freq_output = ft_freqanalysis(cfg_tfr,data); > > cfg_con = []; > cfg_con.method = 'plv'; > plv = ft_connectivityanalysis(cfg_con, freq_output); > > > > > > > -- > Dr. rer. nat. Gregor Volberg > ( mailto:gregor.volberg at psychologie.uni-regensburg.de ) > University of Regensburg > Institute for Experimental Psychology > 93040 Regensburg, Germany > Tel: +49 941 943 3862 > Fax: +49 941 943 3233 > http://www.psychologie.uni-regensburg.de/Greenlee/team/volberg/volberg.html > > > >>> sibylle 4/7/2011 12:55 PM >>> > Dear Fieldtrippers, > > I have a couple of question and I hope someone can help me: > How is it possible to compute plv (for freq data)? > As far as I can remember there used to be an option within > ft_sourcedescriptives, which seems to have disappeared. > How can one use plv to determine connectivity in source space? > > Thanks a lot & best wishes, > > Sibylle > > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip -------------- next part -------------- An HTML attachment was scrubbed... URL: From amrgermany at yahoo.com Fri Apr 8 17:48:50 2011 From: amrgermany at yahoo.com (Amr Ayoub) Date: Fri, 8 Apr 2011 16:48:50 +0100 (BST) Subject: [FieldTrip] =?iso-8859-1?q?_Phd_and_Post-Doc-Positions_in_T=FCbin?= =?iso-8859-1?q?gen_Germany?= Message-ID: <623810.1342.qm@web29006.mail.ird.yahoo.com> Dear all, Prof. Jan Born is offering Phd and Post-Doctoral positions in Tuebingen. Please find the attatched two announcements for details. Thank you, Amr Ayoub -- Institut fuer Neuroendokrinologie Universitaetsklinikum Schleswig-Holstein Ratzeburger Allee 160, Bldg. 50.1 23538 Luebeck Germany Tel: +49 (0)451-500 3642 Fax: +49 (0)451-500 3640 Email: ayoub at kfg.uni-luebeck.de -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: Post-doctoral position 2011.doc Type: application/msword Size: 27648 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: Vacancy_Tuebingen_Germany.pdf Type: application/pdf Size: 7416 bytes Desc: not available URL: From recasensmarc at gmail.com Fri Apr 8 19:49:08 2011 From: recasensmarc at gmail.com (Marc Recasens) Date: Fri, 08 Apr 2011 19:49:08 +0200 Subject: [FieldTrip] Source reconstruction and NAI In-Reply-To: References: Message-ID: <4D9F4A94.8050106@gmail.com> Thank you Jan-Mathijs, I actually did not think about that... However, I did this just to remove the central blobs, independently of the effect it may cause in the different conditions. My aim is to use montecarlo non-parametric statistics afterwards to localize the sources. Don't you think there's gonna be a huge difference between nai-normalized and non-normalized datasets? Thanks again! El 07/04/2011 14:23, jan-mathijs schoffelen escribió: > Dear Marc, > > It seems from your question that you are interested in single trial > reconstructed time series. If your purpose is to do a statistical > comparison across a set of conditions I would not do a noise > normalization at all. You mention that you used a spatial filter > common to the three conditions. As a consequence, the estimate of the > noise will be independent of the condition, so any normalization you > would apply just leads to a scaling of the data, and will not change > the outcome of your statistical test. > Yet, I understand that it sometimes makes sense to do a normalization > in order to be able to make a sensible visualization of the data (i.e. > removing the big central blob). Also, in this case I would compute a > descriptive statistic across the conditions, rather than normalizing > with an estimate of the projected noise (which in FieldTrip is rather > rudimentary because it assumes the noise to be spatially white). You > could for example compute an F-value from a one-factor, three level > anova, or do a pairwise comparison of conditions using a t-test. > Another alternative (which does not affect your statistical test > either), is to work with norm-normalized leadfields. This will take > away the blob in the centre of the volume, and facilitates visualization. > > Best wishes, > > Ja-Mathijs > > > On Apr 5, 2011, at 6:54 PM, Marc Recasens wrote: > >> Dear all, >> >> As far as I know it is possible to reconstruct the time-course of the >> sources (obtained using sourceanalysis) by projecting/multiplying the >> filter-weights on the data. >> In my case, the specific code I am using is: >> >> for i=1:nvoxels(inside) >> >> for tr=1:ntrials >> >> >> ts(tr,:)=(source.avg.ori{source.inside(i)}(1,:)*source.avg.filter{source.inside(i)}*data2{condit}.trial{tr}); >> >> end >> >> datvx(i,:,:)= single_trial_time_course >> >> end >> >> I used a common filter with 3 different conditions, thus I think this >> is the only way I have to reconstruct the activity for one of the >> conditions. >> My Question is about how to apply the NAI normalization here. Can I >> just divide the output of the source reconstruction by the projected >> noise of the filter? I am tempted to do something like that >> >> datvx(i,:,:)= single_trial_time_course ./ >> repmat(noise(inside),[size(ts,1), size(ts,2)] >> >> That is, I divide the power by the noise estimate (for each voxel) in >> every trial and time-point. Could anyone tell me whether this is a >> correct way to procedure? Any other workaround? >> >> >> Thanks in advance! >> >> -- >> Marc Recasens >> Tel.: +34 639 24 15 98 >> >> _______________________________________________ >> fieldtrip mailing list >> fieldtrip at donders.ru.nl >> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > > Dr. J.M. (Jan-Mathijs) Schoffelen > Donders Institute for Brain, Cognition and Behaviour, > Centre for Cognitive Neuroimaging, > Radboud University Nijmegen, The Netherlands > J.Schoffelen at donders.ru.nl > Telephone: 0031-24-3614793 > > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip -- Marc Recasens Tel.: +34 639 24 15 98 -------------- next part -------------- An HTML attachment was scrubbed... URL: From yuvharpaz at gmail.com Fri Apr 8 21:09:01 2011 From: yuvharpaz at gmail.com (Yuval Harpaz) Date: Fri, 8 Apr 2011 22:09:01 +0300 Subject: [FieldTrip] Source reconstruction and NAI In-Reply-To: <4D9F4A94.8050106@gmail.com> References: <4D9F4A94.8050106@gmail.com> Message-ID: Dear Marc If you do normalize every condition it may be better to normalize all conditions to one baseline. this way differences between conditions will not result from differences On 8 April 2011 20:49, Marc Recasens wrote: > Thank you Jan-Mathijs, > I actually did not think about that... > However, I did this just to remove the central blobs, independently of the > effect it may cause in the different conditions. > > My aim is to use montecarlo non-parametric statistics afterwards to > localize the sources. Don't you think there's gonna be a huge difference > between nai-normalized and non-normalized datasets? > yes, they are not comarable. before normlization the scale is very small (say 10^ -13) and after it is a ratio, say 1.8. > > > Thanks again! > > > > El 07/04/2011 14:23, jan-mathijs schoffelen escribió: > > Dear Marc, > > It seems from your question that you are interested in single trial > reconstructed time series. If your purpose is to do a statistical comparison > across a set of conditions I would not do a noise normalization at all. You > mention that you used a spatial filter common to the three conditions. As a > consequence, the estimate of the noise will be independent of the condition, > so any normalization you would apply just leads to a scaling of the data, > and will not change the outcome of your statistical test. > Yet, I understand that it sometimes makes sense to do a normalization in > order to be able to make a sensible visualization of the data (i.e. removing > the big central blob). Also, in this case I would compute a descriptive > statistic across the conditions, rather than normalizing with an estimate of > the projected noise (which in FieldTrip is rather rudimentary because it > assumes the noise to be spatially white). You could for example compute an > F-value from a one-factor, three level anova, or do a pairwise comparison of > conditions using a t-test. > Another alternative (which does not affect your statistical test either), > is to work with norm-normalized leadfields. This will take away the blob in > the centre of the volume, and facilitates visualization. > > Best wishes, > > Ja-Mathijs > > > On Apr 5, 2011, at 6:54 PM, Marc Recasens wrote: > > Dear all, > > As far as I know it is possible to reconstruct the time-course of the > sources (obtained using sourceanalysis) by projecting/multiplying the > filter-weights on the data. > In my case, the specific code I am using is: > > for i=1:nvoxels(inside) > > for tr=1:ntrials > > > ts(tr,:)=(source.avg.ori{source.inside(i)}(1,:)*source.avg.filter{source.inside(i)}*data2{condit}.trial{tr}); > > end > > datvx(i,:,:)= single_trial_time_course > > end > I used a common filter with 3 different conditions, thus I think this is > the only way I have to reconstruct the activity for one of the conditions. > My Question is about how to apply the NAI normalization here. Can I just > divide the output of the source reconstruction by the projected noise of the > filter? I am tempted to do something like that > > datvx(i,:,:)= single_trial_time_course ./ > repmat(noise(inside),[size(ts,1), size(ts,2)] > > That is, I divide the power by the noise estimate (for each voxel) in > every trial and time-point. Could anyone tell me whether this is a correct > way to procedure? Any other workaround? > > > Thanks in advance! > > -- > Marc Recasens > Tel.: +34 639 24 15 98 > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > > > Dr. J.M. (Jan-Mathijs) Schoffelen > Donders Institute for Brain, Cognition and Behaviour, > Centre for Cognitive Neuroimaging, > Radboud University Nijmegen, The Netherlands > J.Schoffelen at donders.ru.nl > Telephone: 0031-24-3614793 > > > _______________________________________________ > fieldtrip mailing listfieldtrip at donders.ru.nlhttp://mailman.science.ru.nl/mailman/listinfo/fieldtrip > > > > -- > Marc Recasens > Tel.: +34 639 24 15 98 > > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > -- Y.Harpaz a link to the BIU MEG lab: http://faculty.biu.ac.il/~goldsa/index.html " Why, Dan," ask the people in Artificial Intelligence, "do you waste your time conferring with those neuroscientists? They wave their hands about information processing and worry about where it happens, and which neurotransmitters are involved, and all those boring facts, but they haven't a clue about the computational requirements of higher cognitive functions." "Why," ask the neuroscientists, "do you waste your time on the fantasies of Artificial Intelligence? They just invent whatever machinery they want, and say unpardonably ignorant things about the brain." The cognitive psychologists, meanwhile, are accused of concocting models with neither biological plausibility nor proven computational powers; the anthropologists wouldn't know a model if they saw one, and the philosophers, as we all know, just take in each other's laundry, warning about confusions they themselves have created, in an arena bereft of both data and empirically testable theories. With so many idiots working on the problem, no wonder consciousness is still a mystery.* Philosopher Daniel Dennet, consciousness explained, pp. 225* -------------- next part -------------- An HTML attachment was scrubbed... URL: From yuvharpaz at gmail.com Fri Apr 8 21:10:59 2011 From: yuvharpaz at gmail.com (Yuval Harpaz) Date: Fri, 8 Apr 2011 22:10:59 +0300 Subject: [FieldTrip] Source reconstruction and NAI In-Reply-To: References: <4D9F4A94.8050106@gmail.com> Message-ID: oops, missing words below in red On 8 April 2011 22:09, Yuval Harpaz wrote: > Dear Marc > If you do normalize every condition it may be better to normalize all > conditions to one baseline. this way differences between conditions will not > result from differences > between the baselines > > On 8 April 2011 20:49, Marc Recasens wrote: > >> Thank you Jan-Mathijs, >> I actually did not think about that... >> However, I did this just to remove the central blobs, independently of the >> effect it may cause in the different conditions. >> >> My aim is to use montecarlo non-parametric statistics afterwards to >> localize the sources. Don't you think there's gonna be a huge difference >> between nai-normalized and non-normalized datasets? >> > yes, they are not comarable. before normlization the scale is very small > (say 10^ -13) and after it is a ratio, say 1.8. > >> >> >> Thanks again! >> >> >> >> El 07/04/2011 14:23, jan-mathijs schoffelen escribió: >> >> Dear Marc, >> >> It seems from your question that you are interested in single trial >> reconstructed time series. If your purpose is to do a statistical comparison >> across a set of conditions I would not do a noise normalization at all. You >> mention that you used a spatial filter common to the three conditions. As a >> consequence, the estimate of the noise will be independent of the condition, >> so any normalization you would apply just leads to a scaling of the data, >> and will not change the outcome of your statistical test. >> Yet, I understand that it sometimes makes sense to do a normalization in >> order to be able to make a sensible visualization of the data (i.e. removing >> the big central blob). Also, in this case I would compute a descriptive >> statistic across the conditions, rather than normalizing with an estimate of >> the projected noise (which in FieldTrip is rather rudimentary because it >> assumes the noise to be spatially white). You could for example compute an >> F-value from a one-factor, three level anova, or do a pairwise comparison of >> conditions using a t-test. >> Another alternative (which does not affect your statistical test either), >> is to work with norm-normalized leadfields. This will take away the blob in >> the centre of the volume, and facilitates visualization. >> >> Best wishes, >> >> Ja-Mathijs >> >> >> On Apr 5, 2011, at 6:54 PM, Marc Recasens wrote: >> >> Dear all, >> >> As far as I know it is possible to reconstruct the time-course of the >> sources (obtained using sourceanalysis) by projecting/multiplying the >> filter-weights on the data. >> In my case, the specific code I am using is: >> >> for i=1:nvoxels(inside) >> >> for tr=1:ntrials >> >> >> ts(tr,:)=(source.avg.ori{source.inside(i)}(1,:)*source.avg.filter{source.inside(i)}*data2{condit}.trial{tr}); >> >> end >> >> datvx(i,:,:)= single_trial_time_course >> >> end >> I used a common filter with 3 different conditions, thus I think this is >> the only way I have to reconstruct the activity for one of the conditions. >> My Question is about how to apply the NAI normalization here. Can I just >> divide the output of the source reconstruction by the projected noise of the >> filter? I am tempted to do something like that >> >> datvx(i,:,:)= single_trial_time_course ./ >> repmat(noise(inside),[size(ts,1), size(ts,2)] >> >> That is, I divide the power by the noise estimate (for each voxel) in >> every trial and time-point. Could anyone tell me whether this is a correct >> way to procedure? Any other workaround? >> >> >> Thanks in advance! >> >> -- >> Marc Recasens >> Tel.: +34 639 24 15 98 >> >> _______________________________________________ >> fieldtrip mailing list >> fieldtrip at donders.ru.nl >> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip >> >> >> Dr. J.M. (Jan-Mathijs) Schoffelen >> Donders Institute for Brain, Cognition and Behaviour, >> Centre for Cognitive Neuroimaging, >> Radboud University Nijmegen, The Netherlands >> J.Schoffelen at donders.ru.nl >> Telephone: 0031-24-3614793 >> >> >> _______________________________________________ >> fieldtrip mailing listfieldtrip at donders.ru.nlhttp://mailman.science.ru.nl/mailman/listinfo/fieldtrip >> >> >> >> -- >> Marc Recasens >> Tel.: +34 639 24 15 98 >> >> >> _______________________________________________ >> fieldtrip mailing list >> fieldtrip at donders.ru.nl >> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip >> > > > > -- > Y.Harpaz > > a link to the BIU MEG lab: > http://faculty.biu.ac.il/~goldsa/index.html > > " Why, Dan," ask the people in Artificial Intelligence, "do you waste your > time conferring with those neuroscientists? They wave their hands about > information processing and worry about where it happens, and > which neurotransmitters are involved, and all those boring facts, but > they haven't a clue about the computational requirements of higher > cognitive functions." "Why," ask the neuroscientists, "do you waste your > time on the fantasies of Artificial Intelligence? They just invent > whatever machinery they want, and say unpardonably ignorant things about the > brain." The cognitive psychologists, meanwhile, are accused of concocting > models with neither biological plausibility nor proven computational powers; > the anthropologists wouldn't know a model if they saw one, and the > philosophers, as we all know, just take in each other's laundry, warning > about confusions they themselves have created, in an arena bereft of both > data and empirically testable theories. With so many idiots working on the > problem, no wonder consciousness is still a mystery.* Philosopher Daniel > Dennet, consciousness explained, pp. 225* > > -- Y.Harpaz a link to the BIU MEG lab: http://faculty.biu.ac.il/~goldsa/index.html " Why, Dan," ask the people in Artificial Intelligence, "do you waste your time conferring with those neuroscientists? They wave their hands about information processing and worry about where it happens, and which neurotransmitters are involved, and all those boring facts, but they haven't a clue about the computational requirements of higher cognitive functions." "Why," ask the neuroscientists, "do you waste your time on the fantasies of Artificial Intelligence? They just invent whatever machinery they want, and say unpardonably ignorant things about the brain." The cognitive psychologists, meanwhile, are accused of concocting models with neither biological plausibility nor proven computational powers; the anthropologists wouldn't know a model if they saw one, and the philosophers, as we all know, just take in each other's laundry, warning about confusions they themselves have created, in an arena bereft of both data and empirically testable theories. With so many idiots working on the problem, no wonder consciousness is still a mystery.* Philosopher Daniel Dennet, consciousness explained, pp. 225* -------------- next part -------------- An HTML attachment was scrubbed... URL: From batrod at gmail.com Sat Apr 9 00:23:20 2011 From: batrod at gmail.com (Rodolphe Nenert) Date: Fri, 8 Apr 2011 17:23:20 -0500 Subject: [FieldTrip] Method montecarlo unknown Message-ID: I decided to download the last Fieldtrip version today, and i tried to run a script doing some montecarlo analysis tahta was previously working. It gave me a strange error: selected 48 channels selected 25 time bins averaging over 1 frequency bins Using the 2-D layout to determine the neighbours ??? Error using ==> ft_neighbourselection at 144 Method 'montecarlo' not known Error in ==> statistics_wrapper at 241 cfg.neighbours = ft_neighbourselection(cfg,varargin{1}); Error in ==> ft_freqstatistics at 127 [stat, cfg] = statistics_wrapper(cfg, varargin{:}); Error in ==> Alpha_stats_montecarlo at 92 [stat] = ft_freqstatistics(cfg, TFRhann_base.data{var1,1:16}, TFRhann_base.data{var2,1:16}); Apparently, when it calls the neighbourselection function, it gives the cfg i specify with cfg.method = 'montecarlo'. Or it should be 'distance' or 'triangulation'. Am i missing something relative to the latest Fieldtrip version? I looked in the documentation but it seems the code hasn' t change. Best regards, Rodolphe Nenert, PhD -------------- next part -------------- An HTML attachment was scrubbed... URL: From jm.horschig at donders.ru.nl Sat Apr 9 12:41:20 2011 From: jm.horschig at donders.ru.nl (=?ISO-8859-1?Q?=22J=F6rn_M=2E_Horschig=22?=) Date: Sat, 09 Apr 2011 12:41:20 +0200 Subject: [FieldTrip] Method montecarlo unknown In-Reply-To: References: Message-ID: <4DA037D0.6070709@donders.ru.nl> Hi Rodolphe, this bug was introduced on the Friday release, since I changed something in ft_neighbourselection (my apologies). Saskia fixed this bug a few minutes ago. So please update your SVN respository, or use the version from Thursday. The new bugfix should be included in the FTP version from tomorrow on. Best, Jörn On 4/9/2011 12:23 AM, Rodolphe Nenert wrote: > I decided to download the last Fieldtrip version today, and i tried to > run a script doing some montecarlo analysis tahta was previously > working. It gave me a strange error: > > selected 48 channels > selected 25 time bins > averaging over 1 frequency bins > Using the 2-D layout to determine the neighbours > ??? Error using ==> ft_neighbourselection at 144 > Method 'montecarlo' not known > > Error in ==> statistics_wrapper at 241 > cfg.neighbours = ft_neighbourselection(cfg,varargin{1}); > > Error in ==> ft_freqstatistics at 127 > [stat, cfg] = statistics_wrapper(cfg, varargin{:}); > > Error in ==> Alpha_stats_montecarlo at 92 > [stat] = ft_freqstatistics(cfg, TFRhann_base.data{var1,1:16}, > TFRhann_base.data{var2,1:16}); > > > Apparently, when it calls the neighbourselection function, it gives > the cfg i specify with cfg.method = 'montecarlo'. Or it should be > 'distance' or 'triangulation'. > Am i missing something relative to the latest Fieldtrip version? > I looked in the documentation but it seems the code hasn' t change. > > Best regards, > > > Rodolphe Nenert, PhD > > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip -- Jörn M. Horschig PhD Student Donders Institute for Brain, Cognition and Behaviour Centre for Cognitive Neuroimaging Radboud University Nijmegen P.O. Box 9101 NL-6500 HB Nijmegen The Netherlands Contact: E-Mail: jm.horschig at donders.ru.nl Tel: +31-(0)24-36-68493 Web: http://www.ru.nl/donders Visiting address: Trigon, room 2.30 Kapitelweg 29 NL-6525 EN Nijmegen The Netherlands -------------- next part -------------- An HTML attachment was scrubbed... URL: From sherrykhan78 at gmail.com Sat Apr 9 15:41:48 2011 From: sherrykhan78 at gmail.com (Sheraz Khan) Date: Sat, 9 Apr 2011 09:41:48 -0400 Subject: [FieldTrip] Coherence Difference Message-ID: Dear fieldtrippers I am very new to fieldtrip, I need to find "Coherence (one meg channel to all MEG channel in sensor space) Differences between two groups in four condition" . Please help in pointing which FT statistics function to used and how to setup CFG for it. Thanks Regards Sheraz Khan -------------- next part -------------- An HTML attachment was scrubbed... URL: From A.Stancak at liverpool.ac.uk Sun Apr 10 21:01:28 2011 From: A.Stancak at liverpool.ac.uk (Stancak, Andrej) Date: Sun, 10 Apr 2011 20:01:28 +0100 Subject: [FieldTrip] possible designs in ft_freqstatistics Message-ID: <0813B54A9D2C494CACBD693C6A2D4D4C14761F95AF@STAFFMBX2.livad.liv.ac.uk> Dear community, we would like to use the ft_freqstatistics function to test differences between 3 conditions (within subjects, 1-way ANOVA), and also another design involving 2 groups of subjects and 2 types of visual stimulation (mixed 2x2 ANOVA). I was able to find examples for comparisons of 2 conditions and wonder if other designs are also possible and where could I find examples of "cfg.design" specification for such statistical models. Best regards Andrej Stancak Andrej Stancak, PhD. Professor for normal physiology Senior lecturer in psychology School of Psychology Eleanor Rathbone Building Bedford Street South L69 7ZA Liverpool United Kingdom Phone: 0044 0151 7946951 E-mail: a.stancak at liverpool.ac.uk (primary) stancak at lf3.cuni.cz (secondary) Office hours: Mo 10-12, Wed 10-12 From manjebrinkhuis at gmail.com Mon Apr 11 20:17:46 2011 From: manjebrinkhuis at gmail.com (Manje Brinkhuis) Date: Mon, 11 Apr 2011 20:17:46 +0200 Subject: [FieldTrip] fieldtrip Digest, Vol 5, Issue 10 In-Reply-To: References: Message-ID: Op 10 apr. 2011 12:00 schreef het volgende: > Send fieldtrip mailing list submissions to > fieldtrip at donders.ru.nl > > To subscribe or unsubscribe via the World Wide Web, visit > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > or, via email, send a message with subject or body 'help' to > fieldtrip-request at donders.ru.nl > > You can reach the person managing the list at > fieldtrip-owner at donders.ru.nl > > When replying, please edit your Subject line so it is more specific > than "Re: Contents of fieldtrip digest..." > > > Today's Topics: > > 1. Re: Method montecarlo unknown (J?rn M. Horschig) > 2. Coherence Difference (Sheraz Khan) > > > ---------------------------------------------------------------------- > > Message: 1 > Date: Sat, 09 Apr 2011 12:41:20 +0200 > From: "J?rn M. Horschig" > To: fieldtrip at donders.ru.nl > Subject: Re: [FieldTrip] Method montecarlo unknown > Message-ID: <4DA037D0.6070709 at donders.ru.nl> > Content-Type: text/plain; charset="iso-8859-1"; Format="flowed" > > Hi Rodolphe, > > this bug was introduced on the Friday release, since I changed something > in ft_neighbourselection (my apologies). Saskia fixed this bug a few > minutes ago. So please update your SVN respository, or use the version > from Thursday. The new bugfix should be included in the FTP version from > tomorrow on. > > Best, > J?rn > > On 4/9/2011 12:23 AM, Rodolphe Nenert wrote: >> I decided to download the last Fieldtrip version today, and i tried to >> run a script doing some montecarlo analysis tahta was previously >> working. It gave me a strange error: >> >> selected 48 channels >> selected 25 time bins >> averaging over 1 frequency bins >> Using the 2-D layout to determine the neighbours >> ??? Error using ==> ft_neighbourselection at 144 >> Method 'montecarlo' not known >> >> Error in ==> statistics_wrapper at 241 >> cfg.neighbours = ft_neighbourselection(cfg,varargin{1}); >> >> Error in ==> ft_freqstatistics at 127 >> [stat, cfg] = statistics_wrapper(cfg, varargin{:}); >> >> Error in ==> Alpha_stats_montecarlo at 92 >> [stat] = ft_freqstatistics(cfg, TFRhann_base.data{var1,1:16}, >> TFRhann_base.data{var2,1:16}); >> >> >> Apparently, when it calls the neighbourselection function, it gives >> the cfg i specify with cfg.method = 'montecarlo'. Or it should be >> 'distance' or 'triangulation'. >> Am i missing something relative to the latest Fieldtrip version? >> I looked in the documentation but it seems the code hasn' t change. >> >> Best regards, >> >> >> Rodolphe Nenert, PhD >> >> >> _______________________________________________ >> fieldtrip mailing list >> fieldtrip at donders.ru.nl >> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > > > -- > J?rn M. Horschig > PhD Student > Donders Institute for Brain, Cognition and Behaviour > Centre for Cognitive Neuroimaging > Radboud University Nijmegen > > P.O. Box 9101 > NL-6500 HB Nijmegen > The Netherlands > > Contact: > E-Mail: jm.horschig at donders.ru.nl > Tel: +31-(0)24-36-68493 > Web: http://www.ru.nl/donders > > Visiting address: > Trigon, room 2.30 > Kapitelweg 29 > NL-6525 EN Nijmegen > The Netherlands > > -------------- next part -------------- > An HTML attachment was scrubbed... > URL: < http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20110409/ebf855fb/attachment-0001.html > > > ------------------------------ > > Message: 2 > Date: Sat, 9 Apr 2011 09:41:48 -0400 > From: Sheraz Khan > To: fieldtrip at donders.ru.nl > Subject: [FieldTrip] Coherence Difference > Message-ID: > Content-Type: text/plain; charset="iso-8859-1" > > Dear fieldtrippers > > I am very new to fieldtrip, I need to find "Coherence (one meg channel to > all MEG channel in sensor space) Differences between two groups in four > condition" . > > Please help in pointing which FT statistics function to used and how to > setup CFG for it. > > Thanks > > Regards > > Sheraz Khan > -------------- next part -------------- > An HTML attachment was scrubbed... > URL: < http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20110409/65517355/attachment-0001.html > > > ------------------------------ > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > > End of fieldtrip Digest, Vol 5, Issue 10 > **************************************** -------------- next part -------------- An HTML attachment was scrubbed... URL: From Jan.Hirschmann at med.uni-duesseldorf.de Tue Apr 12 11:07:06 2011 From: Jan.Hirschmann at med.uni-duesseldorf.de (Jan.Hirschmann at med.uni-duesseldorf.de) Date: Tue, 12 Apr 2011 11:07:06 +0200 Subject: [FieldTrip] I think you solved the problem In-Reply-To: References: Message-ID: <72E993C35FB11743B79FF9286E5B6D8B02676142@Mail2-UKD.VMED.UKD> Dear fieldtrip experts, I have two questions regarding head model creation. As noted on this thread, the volumesegment function was updated and I tested it for our Neuromag data. The segmentation is performed, but unfortunately it is not aligned with the MRI in my case. Here is the code I am using, the fieldtrip is from 9th April 2011. %read mri mri = ft_read_mri(subject_files.fiff_mri); mri.anatomy=double(mri.anatomy); %these are the fiducials for this subject taken from the Neuromag GUI for coregistration cfg=[]; cfg.fiducial.rpa=[136.35 142.80 31.96]; cfg.fiducial.nas=[47.84 101.80 100.10]; cfg.fiducial.lpa=[139.22 146.17 162.69]; %define the head coordinate system according to CTF conventions cfg.method='fiducial'; real_mri=ft_volumerealign(cfg,mri); %segment cfg = []; cfg.template = '/data/apps/spm/spm8/templates/T1.nii'; cfg.coordinates = 'ctf'; cfg.keepintermediate = 'no'; segmentedmri = ft_volumesegment(cfg, real_mri); %plot white matter test=segmentedmri; test.anatomy=real_mri.anatomy; cfg=[]; cfg.funparameter='white'; ft_sourceplot(cfg,test); %see attached picture The other issue regards back-transformation from CTF to Neuromag coordinates, which is necessary to make the head model fit the sensors. My idea was to create an appropriate transformation matrix like this. cd /net/avidya/storage/home/jan/fieldtrip-20110409/private ctfmat=headcoordinates(nas,lpa,rpa,'ctf'); nmmat=headcoordinates(nas,lpa,rpa,'neuromag'); ctf_to_nm=nmmat/ctfmat; And then to use it on the head model to bring it back into Neuromag coordinates: %create single shell, realistic headmodel cfg = []; hdm = ft_prepare_singleshell(cfg,segmentedmri); % transformation of headmodel into Neuromag space hdm.bnd.pnt=warp_apply(ctf_to_nm,hdm.bnd.pnt,'homogeneous'); Does this survive a sanity check? Best regards and thanks a lot, Jan ________________________________ Von: fieldtrip-bounces at donders.ru.nl [mailto:fieldtrip-bounces at donders.ru.nl] Im Auftrag von Jen Whitman Gesendet: Montag, 28. Februar 2011 22:32 An: Email discussion list for the FieldTrip project Betreff: [FieldTrip] I think you solved the problem I just checked, and when I re-ran my segmentation script with the new Fieldtrip in order to use an spm8 template image, coordinates got reversed. When I take out the calls to flipdim, they look fine (see attached screenshots). That certainly explains the meaningless results I was getting! Thanks for figuring that out, Jen On Mon, Feb 28, 2011 at 12:36 PM, jan-mathijs schoffelen < jan.schoffelen at donders.ru.nl> wrote: Hi Jen, At first glance I have a comment on your script. You may need to explicitly check the alignment of your segmented volume and the original anatomy. A while a go some changes were made to ft_volumesegment, taking away the need to do the flipdim(flipdim... operations. I have posted this on the discussion list last January, but you may not have noticed. Anyway, if you now have used a recent version of FieldTrip for your segmentation both the location of your dipole grid, and the volume conductor model will not be adequately coregistered with the data, which may lead to funky results to begin with. That's most likely not related to the filetype in which the volumes are saved for later use. Best wishes, Jan-Mathijs On Feb 28, 2011, at 8:59 PM, Jen Whitman wrote: Hello Jan, When calling volumesegment, I specified 'ctf' as the coordinate system. The function I wrote to call volumesegment and prepare_singleshell for each subject and save the results is pasted below, with a couple of comments added for clarity. Over the weekend I tried specifying the coordinate system in the call to ft_volumenormalise as 'ctf' rather than 'spm', and commented out all the lines that said cfg.spmversion = 'spm8'; before calling a function. However, that created worse results, as each plot involved stripes of activation and empty voxels, suggesting that 'ctf' was not the correct coordinate system to specify. Thanks for the attached script. Looking in that the comments in that, I suspect that the solution to my problems will be to specify my filetype as nifti_img rather than nifti. I'll let you know how that goes. Jen ------------------------------------------------------------------------ ------------------------------------ % the variable subj is simply a string consisting of a subject number (e.g. 's05') which can be a folder name or part of a filename function [vol mri segmentedmri segmentedmriF]=call_volume_segment_function_spm8(subj) cfg.spmversion = 'spm8'; cfg.template = '/home/woodwardlab/spm8/templates/EPI.nii'; %cfg.template='/home/common/matlab/spm2/templates/T1.mnc'; cfg.name=[subj '_volseg']; cfg.write='yes'; cfg.smooth='no'; cfg.coordinates='ctf'; mri=read_mri([subj '/mri/' subj 'head.mri']); % made with CTF mriConverter and mriViewer software, after fiducials were marked segmentedmri = volumesegment(cfg, mri); segmentedmriF = segmentedmri; segmentedmriF.gray = flipdim(flipdim(flipdim(segmentedmriF.gray,3),2),1); segmentedmriF.white = flipdim(flipdim(flipdim(segmentedmriF.white,3),2),1); segmentedmriF.csf = flipdim(flipdim(flipdim(segmentedmriF.csf,3),2),1); segmentedmriF.transform = mri.transform; segmentedmriF.anatomy = mri.anatomy; cfg = []; cfg.spmversion = 'spm8'; vol = prepare_singleshell(cfg, segmentedmriF); eval(['save ' subj '/meg/mrisegmented.mat mri segmentedmri segmentedmriF vol']) On Sat, Feb 26, 2011 at 5:26 AM, jan-mathijs schoffelen < jan.schoffelen at donders.ru.nl> wrote: Dear Jen, I do not manage to reproduce your issue, when only focussing on the ft_volumewrite and visualization part of your pipeline. See attached script, and yet an updated version of ft_volumewrite which you need to (hopefully) draw the same conclusion as I did. Yet, I only now realize that your question may pertain to the entire pipeline. It could be that something is going wrong there. I only see now that in the part of your script of which you reported that it gave 'good' results, you specify cfg.coordinates = 'ctf' before calling ft_volumenormalise. I assume this is correct, because the coordinate system your source-reconstructed data lives in, is according to the CTF-convention, and not according to the SPM-convention. On the other hand, the template for the spatial normalization lives in the SPM-coordinate system. In order for the spatial normalization to work OK, Fieldtrip tries to convert from one coordinate system to the other (once again, this is appropriate behaviour), before doing the actual normalization. It seems that at least in the script you sent along, in the final (not working version), you specified cfg.coordinates = 'spm' prior to calling ft_volumenormalise. This is probably wrong. Another important point that should be mentioned, is that the coordinate systems in which the functional data and the anatomical data live should be the same for the ft_sourceinterpolate to make sense. In other words, if your source reconstructed images are defined on a 3D grid of positions in CTF-space, the mri.transform of your anatomy should describe a transformation from voxel to CTF-space. I think you may want to revisit step by step this part of the pipeline; I don't think the problem lies in the writing. A final possibility of course is that Mricron is misbehaving... Best, Jan-Mathijs On Feb 25, 2011, at 9:44 PM, Jen Whitman wrote: Hi Jan, I tried re-running the analysis with the new script you sent me, and the latest version of fieldtrip (since I needed ft_get_opt as well), but the spm8 images being written are still producing flawed results. It's the same problem as I mentioned briefly in my previous post. I am not getting any error messages when writing these images. Rather, my problem is that the spm8 and spm2 results from the same data ought to be identical when viewed in mricron, but they're far from it. When I use mricron to look at the results from the spm8-format images, combined across participants to create a t-image, I just get a single 'blob' spanning roughly half the brain. In contrast, when I used spm2-format previously on the same data, the t-image was much more meaningful; a posterior alpha power decrease in a set of regions corresponding to the 'task-positive network' (a network found in the results of an fMRI version of my experiment, and widely reported in the fMRI literature). This failure to replicate the spm2 results when using spm8 images from the same data leads me to suspect that something is wrong with the coordinates for spm8 format. However, after experimenting extensively with different cfg options I still haven't identified the problem. If I my structural MRIs have been saved to .mri files using CTF's MRIConverter program, which cfg options, particularly for coordinates, template images, and filetypes, should I specify before calling the ft_volumesegment, ft_prepare_singleshell, ft_sourceinterpolate, ft_volumenormalise, and ft_volumewrite functions? Or should I be calling a different set of functions now? Thanks again for your help, Jen On Thu, Feb 24, 2011 at 10:07 AM, Jen Whitman wrote: Great, thanks! I'll start the analysis with your new script today and will let you know how it works out. Jen On Thu, Feb 24, 2011 at 4:44 AM, jan-mathijs schoffelen < jan.schoffelen at donders.ru.nl> wrote: Dear Jen, I managed to reproduce your problem. The code was rather buggy and indeed ft_volumewrite did not behave as it should have. I now fixed it in the code and it should run fine now. Please find the updated file attached. It will be available on our ftp-server as of tonight. Please note that I updated the documentation, and changed the names of some of the options a bit. If you want to save your data in analyze-format, you should specify cfg.filetype = 'analyze_spm'. If you specify cfg.filetype = 'nifti', it should write out a volume to nifti-format, using SPM8. Best wishes, Jan-Mathijs On Feb 23, 2011, at 7:44 PM, Jen Whitman wrote: Dear Jan, Thanks for the quick reply. Yes, I have tried it out quite a few times now, experimenting with different settings in the cfgs. Below I'll paste the code I've been using to write images - first the code that successfully created spm2 images that produced good results, then the code used for creating nifti format images from the same data. The comments in this second part are at this point a bit of a maze of cfg options I've been changing back & forth. Any insights/suggestions regarding how to set up my cfgs to make this work would be greatly appreciated. Jen %%%%%%%% this code generated spm2-compatible images which did work (producing results that made sense). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% sourcetemp.avg.pow = (sourcetemp.avg.pow - sourcePre.avg.pow) ./ sourcePre.avg.pow; cfg = []; cfg.downsample = 2; sourcetempInt = sourceinterpolate(cfg, sourcetemp , mri); % projecting the plot onto a surface... cfg = []; cfg.coordinates = 'ctf'; cfg.template = '/home/common/matlab/spm2/templates/T1.mnc'; %this template is in MNI coordinates sourcetempIntN = volumenormalise(cfg, sourcetempInt); filename=[subj 'run' int2str(r) 'cond' int2str(cond) '_' int2str(f) 'HzWin' int2str(win) 'width750ms']; cfg=[]; cfg.parameter = 'avg.pow'; % string, describing the functional data to be processed, e.g. 'pow', 'coh' or 'nai' cfg.filename = [filename '.img']; %'testimageoutput_alphafreq'; % filename without the extension cfg.filetype = 'spm'; %'analyze', 'spm', 'vmp' or 'vmr' cfg.coordinates = 'spm'; %'spm, 'ctf' or empty for interactive (default = []) cfg.datatype = 'double'; %'float'; %'double'; %'bit1', 'uint8', 'int16', 'int32', 'float' or 'double' volumewrite(cfg, sourcetempIntN) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%% this code below hasn't worked yet... % I added cfg.spmversion = 'spm8'; % in the cfgs for the calls to ft_prepare_leadfield and ft_sourceanalysis, % and in the call to prepare_singleshell after calling volumesegment % I've also ensured that spm8 is the only spm version in my path, even in % the fieldtrip/external folder, and ensured that spm8 is installed properly % (files compiled correctly, etc..) sourcetemp.avg.pow = (sourcetemp.avg.pow - sourcePre.avg.pow) ./ sourcePre.avg.pow; filename=[subj 'run' int2str(r) 'cond' int2str(cond) '_' int2str(f) 'Hzspm8_FIXv9_Win' int2str(win) 'width750ms.img']; cfg = []; % cfg.coordinates = 'spm'; % changed for version 5 % cfg.spmversion = 'spm8'; % changed for version 5 cfg.downsample = 4; sourcetempInt = ft_sourceinterpolate(cfg, sourcetemp , mri); % projecting the plot onto a surface... cfg = []; %cfg.coordinates = 'spm'; % changed for version 5 %cfg.coordinates = 'ctf'; % changed for version 5 cfg.coordinates = 'spm'; % changed back to spm for version 9 cfg.downsample = 4; %cfg.spmversion = 'spm8'; % changed for version 6 (because this gets specified in volumewrite) cfg.template = 'Hmatrix/mask.nii.nii'; % basically equivalent to using spm8/templates/EPI.nii, except that mask.nii (produced from fmri data) has the desired voxel size % cfg.name = [filename]; % changed for version 6 %cfg.write= 'yes'; % changed for version 6 (when this was set to 'yes' there was no subsequent call to volumewrite) cfg.write= 'no'; % changed for version 6 sourcetempIntN = ft_volumenormalise(cfg, sourcetempInt); % this whole cfg and function call added for version 6 cfg=[]; % cfg.parameter = string, describing the functional data to be processed, e.g. 'pow', 'coh' or 'nai' % cfg.filename = filename without the extension % cfg.filetype = 'analyze', 'spm', 'vmp' or 'vmr' % cfg.vmpversion = 1 or 2 (default) version of the vmp-format to use % cfg.coordinates = 'spm, 'ctf' or empty for interactive (default = []) cfg.parameter='pow'; cfg.filename=filename; cfg.filetype = 'spm'; cfg.spmversion = 'SPM8'; % capitalized after first error message from vers 6 % cfg.dataformat='nifti'; % added after first error message from vers 6 % commented out after 2nd error message from vers 6 %cfg.vmpversion=2; % this is a filetype, like spm, so don't need to specify unless cfg.filetyp='vmp' cfg.coordinates='spm'; ft_volumewrite(cfg,sourcetempIntN); On Wed, Feb 23, 2011 at 7:50 AM, jan-mathijs schoffelen wrote: Dear Jen, I notice that indeed in the documentation section of ft_write_volume there is a FIXME behind nifti. Yet, nifti format seems to be supported by ft_write_volume (at least in a recent version of fieldtrip). Did you try it at all (and ran into problems) or were you held back by the FIXME statement? Could you just try it out using a recent fieldtrip function? Thanks and best wishes Jan-Mathijs On Feb 23, 2011, at 2:21 AM, Jen Whitman wrote: Hello, While writing beamformed images to spm2 format in a previous version of fieldtrip (now lost due to a computer crash), I was able to get nice-looking results; networks of brain regions consistent with existing literature. When I try to write images from the same dataset and the same analysis to spm8 format, my results (t-images computed across subjects) end up being single clusters spanning large sections of the brain (e.g. a 'blob' spanning all of one hemisphere but not the other). Unfortunately, some aspects of my planned data analyses cannot be performed on spm2 images, so I have to find a way of writing to successfully to nifti format. I just noticed that in the comments in the ft_write_volume function, which I am calling via ft_volumewrite, it says 'FIXME' next to nifti under the list of supported dataformats. Is there by any chance a patch out there for writing nifti images? Thanks! _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: misalignment.png Type: image/png Size: 105466 bytes Desc: misalignment.png URL: From jan.schoffelen at donders.ru.nl Tue Apr 12 12:10:47 2011 From: jan.schoffelen at donders.ru.nl (jan-mathijs schoffelen) Date: Tue, 12 Apr 2011 12:10:47 +0200 Subject: [FieldTrip] I think you solved the problem In-Reply-To: <72E993C35FB11743B79FF9286E5B6D8B02676142@Mail2-UKD.VMED.UKD> References: <72E993C35FB11743B79FF9286E5B6D8B02676142@Mail2-UKD.VMED.UKD> Message-ID: <7B5CA863-D143-404C-BCB9-805AA6E6E546@donders.ru.nl> Dear Jan, Apart from not being properly aligned, the segmentation looks a bit strange to me. I suspect that not everything went well here ;o). Could you try the following: specify cfg.coordsys = 'neuromag', both in your call to ft_volumerealign and in your call to ft_volumesegment. The cfg.coordinates for ft_volumesegment has to be removed (actually it is a deprecated option). The idea now is that mri-structures in fieldtrip can have a coordsys field, which allows for more transparent use of the different head coordinate system conventions. This takes away the need for intermediately coregistering the MRI in 'ctf'-convention, and would also take away your need to call headcoordinates later on. Best wishes, Jan-Mathijs On Apr 12, 2011, at 11:07 AM, wrote: > Dear fieldtrip experts, > > I have two questions regarding head model creation. As noted on this > thread, the volumesegment function was updated and I tested it for > our Neuromag data. The segmentation is performed, but unfortunately > it is not aligned with the MRI in my case. Here is the code I am > using, the fieldtrip is from 9th April 2011. > > %read mri > mri = ft_read_mri(subject_files.fiff_mri); > mri.anatomy=double(mri.anatomy); > > %these are the fiducials for this subject taken from the Neuromag > GUI for coregistration > cfg=[]; > cfg.fiducial.rpa=[136.35 142.80 31.96]; > cfg.fiducial.nas=[47.84 101.80 100.10]; > cfg.fiducial.lpa=[139.22 146.17 162.69]; > > %define the head coordinate system according to CTF conventions > cfg.method='fiducial'; > real_mri=ft_volumerealign(cfg,mri); > > %segment > cfg = []; > cfg.template = '/data/apps/spm/spm8/templates/T1.nii'; > cfg.coordinates = 'ctf'; > cfg.keepintermediate = 'no'; > segmentedmri = ft_volumesegment(cfg, real_mri); > > %plot white matter > test=segmentedmri; > test.anatomy=real_mri.anatomy; > cfg=[]; > cfg.funparameter='white'; > ft_sourceplot(cfg,test); %see attached picture > > The other issue regards back-transformation from CTF to Neuromag > coordinates, which is necessary to make the head model fit the > sensors. My idea was to create an appropriate transformation matrix > like this. > > cd /net/avidya/storage/home/jan/fieldtrip-20110409/private > ctfmat=headcoordinates(nas,lpa,rpa,'ctf'); > nmmat=headcoordinates(nas,lpa,rpa,'neuromag'); > ctf_to_nm=nmmat/ctfmat; > > > And then to use it on the head model to bring it back into Neuromag > coordinates: > > %create single shell, realistic headmodel > cfg = []; > hdm = ft_prepare_singleshell(cfg,segmentedmri); > > % transformation of headmodel into Neuromag space > hdm.bnd.pnt=warp_apply(ctf_to_nm,hdm.bnd.pnt,'homogeneous'); > > Does this survive a sanity check? > > Best regards and thanks a lot, > > Jan > > > Von: fieldtrip-bounces at donders.ru.nl [mailto:fieldtrip-bounces at donders.ru.nl > ] Im Auftrag von Jen Whitman > Gesendet: Montag, 28. Februar 2011 22:32 > An: Email discussion list for the FieldTrip project > Betreff: [FieldTrip] I think you solved the problem > > I just checked, and when I re-ran my segmentation script with the > new Fieldtrip in order to use an spm8 template image, coordinates > got reversed. When I take out the calls to flipdim, they look fine > (see attached screenshots). That certainly explains the meaningless > results I was getting! > > Thanks for figuring that out, > > Jen > > On Mon, Feb 28, 2011 at 12:36 PM, jan-mathijs schoffelen > wrote: > Hi Jen, > > At first glance I have a comment on your script. You may need to > explicitly check the alignment of your segmented volume and the > original anatomy. A while a go some changes were made to > ft_volumesegment, taking away the need to do the flipdim(flipdim... > operations. I have posted this on the discussion list last January, > but you may not have noticed. > Anyway, if you now have used a recent version of FieldTrip for your > segmentation both the location of your dipole grid, and the volume > conductor model will not be adequately coregistered with the data, > which may lead to funky results to begin with. That's most likely > not related to the filetype in which the volumes are saved for later > use. > > Best wishes, > > Jan-Mathijs > > > > On Feb 28, 2011, at 8:59 PM, Jen Whitman wrote: > > > Hello Jan, > > When calling volumesegment, I specified 'ctf' as the coordinate > system. The function I wrote to call volumesegment and > prepare_singleshell for each subject and save the results is pasted > below, with a couple of comments added for clarity. > Over the weekend I tried specifying the coordinate system in the > call to ft_volumenormalise as 'ctf' rather than 'spm', and commented > out all the lines that said cfg.spmversion = 'spm8'; before calling > a function. However, that created worse results, as each plot > involved stripes of activation and empty voxels, suggesting that > 'ctf' was not the correct coordinate system to specify. > > Thanks for the attached script. Looking in that the comments in > that, I suspect that the solution to my problems will be to specify > my filetype as nifti_img rather than nifti. I'll let you know how > that goes. > > Jen > > ------------------------------------------------------------------------------------------------------------ > % the variable subj is simply a string consisting of a subject > number (e.g. 's05') which can be a folder name or part of a filename > function [vol mri segmentedmri > segmentedmriF]=call_volume_segment_function_spm8(subj) > cfg.spmversion = 'spm8'; > cfg.template = '/home/woodwardlab/spm8/templates/EPI.nii'; > %cfg.template='/home/common/matlab/spm2/templates/T1.mnc'; > cfg.name=[subj '_volseg']; > cfg.write='yes'; > cfg.smooth='no'; > cfg.coordinates='ctf'; > mri=read_mri([subj '/mri/' subj 'head.mri']); % made with CTF > mriConverter and mriViewer software, after fiducials were marked > segmentedmri = volumesegment(cfg, mri); > segmentedmriF = segmentedmri; > segmentedmriF.gray = flipdim(flipdim(flipdim(segmentedmriF.gray,3), > 2),1); > segmentedmriF.white = flipdim(flipdim(flipdim(segmentedmriF.white,3), > 2),1); > segmentedmriF.csf = flipdim(flipdim(flipdim(segmentedmriF.csf,3), > 2),1); > segmentedmriF.transform = mri.transform; > segmentedmriF.anatomy = mri.anatomy; > cfg = []; > cfg.spmversion = 'spm8'; > vol = prepare_singleshell(cfg, segmentedmriF); > eval(['save ' subj '/meg/mrisegmented.mat mri segmentedmri > segmentedmriF vol']) > > > > On Sat, Feb 26, 2011 at 5:26 AM, jan-mathijs schoffelen > wrote: > Dear Jen, > > I do not manage to reproduce your issue, when only focussing on the > ft_volumewrite and visualization part of your pipeline. See attached > script, and yet an updated version of ft_volumewrite which you need > to (hopefully) draw the same conclusion as I did. > Yet, I only now realize that your question may pertain to the entire > pipeline. It could be that something is going wrong there. > I only see now that in the part of your script of which you reported > that it gave 'good' results, you specify cfg.coordinates = 'ctf' > before calling ft_volumenormalise. I assume this is correct, because > the coordinate system your source-reconstructed data lives in, is > according to the CTF-convention, and not according to the SPM- > convention. On the other hand, the template for the spatial > normalization lives in the SPM-coordinate system. In order for the > spatial normalization to work OK, Fieldtrip tries to convert from > one coordinate system to the other (once again, this is appropriate > behaviour), before doing the actual normalization. It seems that at > least in the script you sent along, in the final (not working > version), you specified cfg.coordinates = 'spm' prior to calling > ft_volumenormalise. This is probably wrong. > Another important point that should be mentioned, is that the > coordinate systems in which the functional data and the anatomical > data live should be the same for the ft_sourceinterpolate to make > sense. In other words, if your source reconstructed images are > defined on a 3D grid of positions in CTF-space, the mri.transform of > your anatomy should describe a transformation from voxel to CTF-space. > I think you may want to revisit step by step this part of the > pipeline; I don't think the problem lies in the writing. > A final possibility of course is that Mricron is misbehaving... > > Best, > > Jan-Mathijs > > > > > > > On Feb 25, 2011, at 9:44 PM, Jen Whitman wrote: > > > Hi Jan, > > I tried re-running the analysis with the new script you sent me, and > the latest version of fieldtrip (since I needed ft_get_opt as well), > but the spm8 images being written are still producing flawed > results. It's the same problem as I mentioned briefly in my previous > post. I am not getting any error messages when writing these images. > Rather, my problem is that the spm8 and spm2 results from the same > data ought to be identical when viewed in mricron, but they're far > from it. When I use mricron to look at the results from the spm8- > format images, combined across participants to create a t-image, I > just get a single 'blob' spanning roughly half the brain. In > contrast, when I used spm2-format previously on the same data, the t- > image was much more meaningful; a posterior alpha power decrease in > a set of regions corresponding to the 'task-positive network' (a > network found in the results of an fMRI version of my experiment, > and widely reported in the fMRI literature). > > This failure to replicate the spm2 results when using spm8 images > from the same data leads me to suspect that something is wrong with > the coordinates for spm8 format. However, after experimenting > extensively with different cfg options I still haven't identified > the problem. If I my structural MRIs have been saved to .mri files > using CTF's MRIConverter program, which cfg options, particularly > for coordinates, template images, and filetypes, should I specify > before calling the ft_volumesegment, ft_prepare_singleshell, > ft_sourceinterpolate, ft_volumenormalise, and ft_volumewrite > functions? Or should I be calling a different set of functions now? > > Thanks again for your help, > > Jen > > On Thu, Feb 24, 2011 at 10:07 AM, Jen Whitman > wrote: > Great, thanks! > > I'll start the analysis with your new script today and will let you > know how it works out. > > Jen > > On Thu, Feb 24, 2011 at 4:44 AM, jan-mathijs schoffelen > wrote: > Dear Jen, > > I managed to reproduce your problem. The code was rather buggy and > indeed ft_volumewrite did not behave as it should have. I now fixed > it in the code and it should run fine now. Please find the updated > file attached. It will be available on our ftp-server as of tonight. > Please note that I updated the documentation, and changed the names > of some of the options a bit. If you want to save your data in > analyze-format, you should specify cfg.filetype = 'analyze_spm'. If > you specify cfg.filetype = 'nifti', it should write out a volume to > nifti-format, using SPM8. > > Best wishes, > > Jan-Mathijs > > > > > > On Feb 23, 2011, at 7:44 PM, Jen Whitman wrote: > >> >> Dear Jan, >> >> Thanks for the quick reply. Yes, I have tried it out quite a few >> times now, experimenting with different settings in the cfgs. Below >> I'll paste the code I've been using to write images - first the >> code that successfully created spm2 images that produced good >> results, then the code used for creating nifti format images from >> the same data. The comments in this second part are at this point a >> bit of a maze of cfg options I've been changing back & forth. Any >> insights/suggestions regarding how to set up my cfgs to make this >> work would be greatly appreciated. >> >> Jen >> >> >> %%%%%%%% this code generated spm2-compatible images which did work >> (producing results that made sense). >> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% >> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% >> >> sourcetemp.avg.pow = (sourcetemp.avg.pow - >> sourcePre.avg.pow) ./ sourcePre.avg.pow; >> >> cfg = []; >> cfg.downsample = 2; >> sourcetempInt = sourceinterpolate(cfg, sourcetemp , mri); >> >> % projecting the plot onto a surface... >> cfg = []; >> cfg.coordinates = 'ctf'; >> cfg.template = '/home/common/matlab/spm2/templates/T1.mnc'; >> %this template is in MNI coordinates >> sourcetempIntN = volumenormalise(cfg, sourcetempInt); >> >> filename=[subj 'run' int2str(r) 'cond' int2str(cond) '_' >> int2str(f) 'HzWin' int2str(win) 'width750ms']; >> cfg=[]; >> cfg.parameter = 'avg.pow'; % string, describing the >> functional data to be processed, e.g. 'pow', 'coh' or 'nai' >> cfg.filename = [filename '.img']; >> %'testimageoutput_alphafreq'; % filename without the extension >> cfg.filetype = 'spm'; %'analyze', 'spm', 'vmp' or 'vmr' >> cfg.coordinates = 'spm'; %'spm, 'ctf' or empty for >> interactive (default = []) >> cfg.datatype = 'double'; %'float'; %'double'; %'bit1', 'uint8', >> 'int16', 'int32', 'float' or 'double' >> >> volumewrite(cfg, sourcetempIntN) >> >> >> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% >> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% >> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% >> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% >> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% >> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% >> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% >> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% >> %%%%% this code below hasn't worked yet... >> >> % I added cfg.spmversion = 'spm8'; >> % in the cfgs for the calls to ft_prepare_leadfield and >> ft_sourceanalysis, >> % and in the call to prepare_singleshell after calling volumesegment >> >> % I've also ensured that spm8 is the only spm version in my path, >> even in >> % the fieldtrip/external folder, and ensured that spm8 is installed >> properly >> % (files compiled correctly, etc..) >> >> sourcetemp.avg.pow = (sourcetemp.avg.pow - >> sourcePre.avg.pow) ./ sourcePre.avg.pow; >> >> filename=[subj 'run' int2str(r) 'cond' int2str(cond) '_' >> int2str(f) 'Hzspm8_FIXv9_Win' int2str(win) 'width750ms.img']; >> >> cfg = []; >> % cfg.coordinates = 'spm'; % changed for version 5 >> % cfg.spmversion = 'spm8'; % changed for version 5 >> cfg.downsample = 4; >> sourcetempInt = ft_sourceinterpolate(cfg, sourcetemp , mri); >> >> >> % projecting the plot onto a surface... >> cfg = []; >> %cfg.coordinates = 'spm'; % changed for version 5 >> %cfg.coordinates = 'ctf'; % changed for version 5 >> cfg.coordinates = 'spm'; % changed back to spm for version 9 >> cfg.downsample = 4; >> %cfg.spmversion = 'spm8'; % changed for version 6 (because this >> gets specified in volumewrite) >> cfg.template = 'Hmatrix/mask.nii.nii'; % basically equivalent >> to using spm8/templates/EPI.nii, except that mask.nii (produced >> from fmri data) has the desired voxel size >> % cfg.name = [filename]; % changed for version 6 >> %cfg.write= 'yes'; % changed for version 6 (when this was set >> to 'yes' there was no subsequent call to volumewrite) >> cfg.write= 'no'; % changed for version 6 >> sourcetempIntN = ft_volumenormalise(cfg, sourcetempInt); >> >> % this whole cfg and function call added for version 6 >> cfg=[]; >> % cfg.parameter = string, describing the functional data >> to be processed, e.g. 'pow', 'coh' or 'nai' >> % cfg.filename = filename without the extension >> % cfg.filetype = 'analyze', 'spm', 'vmp' or 'vmr' >> % cfg.vmpversion = 1 or 2 (default) version of the vmp-format >> to use >> % cfg.coordinates = 'spm, 'ctf' or empty for interactive >> (default = []) >> cfg.parameter='pow'; >> cfg.filename=filename; >> cfg.filetype = 'spm'; >> cfg.spmversion = 'SPM8'; % capitalized after first error >> message from vers 6 >> % cfg.dataformat='nifti'; % added after first error message from >> vers 6 >> % commented out after 2nd error >> message from vers 6 >> %cfg.vmpversion=2; % this is a filetype, like spm, so don't >> need to specify unless cfg.filetyp='vmp' >> cfg.coordinates='spm'; >> ft_volumewrite(cfg,sourcetempIntN); >> >> >> >> >> >> On Wed, Feb 23, 2011 at 7:50 AM, jan-mathijs schoffelen > > wrote: >> Dear Jen, >> >> I notice that indeed in the documentation section of >> ft_write_volume there is a FIXME behind nifti. Yet, nifti format >> seems to be supported by ft_write_volume (at least in a recent >> version of fieldtrip). Did you try it at all (and ran into >> problems) or were you held back by the FIXME statement? Could you >> just try it out using a recent fieldtrip function? >> >> Thanks and best wishes >> >> Jan-Mathijs >> >> >> >> On Feb 23, 2011, at 2:21 AM, Jen Whitman wrote: >> >> Hello, >> >> While writing beamformed images to spm2 format in a previous >> version of fieldtrip (now lost due to a computer crash), I was able >> to get nice-looking results; networks of brain regions consistent >> with existing literature. When I try to write images from the same >> dataset and the same analysis to spm8 format, my results (t-images >> computed across subjects) end up being single clusters spanning >> large sections of the brain (e.g. a 'blob' spanning all of one >> hemisphere but not the other). Unfortunately, some aspects of my >> planned data analyses cannot be performed on spm2 images, so I have >> to find a way of writing to successfully to nifti format. >> >> I just noticed that in the comments in the ft_write_volume >> function, which I am calling via ft_volumewrite, it says 'FIXME' >> next to nifti under the list of supported dataformats. Is there by >> any chance a patch out there for writing nifti images? >> >> Thanks! >> >> _______________________________________________ >> fieldtrip mailing list >> fieldtrip at donders.ru.nl >> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip >> >> Dr. J.M. (Jan-Mathijs) Schoffelen >> Donders Institute for Brain, Cognition and Behaviour, >> Centre for Cognitive Neuroimaging, >> Radboud University Nijmegen, The Netherlands >> J.Schoffelen at donders.ru.nl >> Telephone: 0031-24-3614793 >> >> _______________________________________________ >> fieldtrip mailing list >> fieldtrip at donders.ru.nl >> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip >> >> _______________________________________________ >> fieldtrip mailing list >> fieldtrip at donders.ru.nl >> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > > > Dr. J.M. (Jan-Mathijs) Schoffelen > Donders Institute for Brain, Cognition and Behaviour, > Centre for Cognitive Neuroimaging, > Radboud University Nijmegen, The Netherlands > J.Schoffelen at donders.ru.nl > Telephone: 0031-24-3614793 > > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > > Dr. J.M. (Jan-Mathijs) Schoffelen > Donders Institute for Brain, Cognition and Behaviour, > Centre for Cognitive Neuroimaging, > Radboud University Nijmegen, The Netherlands > J.Schoffelen at donders.ru.nl > Telephone: 0031-24-3614793 > > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > > Dr. J.M. (Jan-Mathijs) Schoffelen > Donders Institute for Brain, Cognition and Behaviour, > Centre for Cognitive Neuroimaging, > Radboud University Nijmegen, The Netherlands > J.Schoffelen at donders.ru.nl > Telephone: 0031-24-3614793 > > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 -------------- next part -------------- An HTML attachment was scrubbed... URL: From Jan.Hirschmann at med.uni-duesseldorf.de Tue Apr 12 13:08:55 2011 From: Jan.Hirschmann at med.uni-duesseldorf.de (Jan.Hirschmann at med.uni-duesseldorf.de) Date: Tue, 12 Apr 2011 13:08:55 +0200 Subject: [FieldTrip] I think you solved the problem In-Reply-To: <7B5CA863-D143-404C-BCB9-805AA6E6E546@donders.ru.nl> References: <72E993C35FB11743B79FF9286E5B6D8B02676142@Mail2-UKD.VMED.UKD> <7B5CA863-D143-404C-BCB9-805AA6E6E546@donders.ru.nl> Message-ID: <72E993C35FB11743B79FF9286E5B6D8B0267618F@Mail2-UKD.VMED.UKD> Dear JM, thanks a lot. I have actually just realized a few minutes ago that volumesegment and volumerealign are now supporting neuromag this way. It works just fine. I was already surprised that headcoordinates has a flag for neuromag now, and it should have occured to me that this means that also the higher-level functions were changed. Could I ask you to include this new feature in the help? I could also put an example script online if that is helpful for communicating this aspect (in case it hasn't been communicated long ago and I just missed it). Best, jan ________________________________ Von: fieldtrip-bounces at donders.ru.nl [mailto:fieldtrip-bounces at donders.ru.nl] Im Auftrag von jan-mathijs schoffelen Gesendet: Dienstag, 12. April 2011 12:11 An: Email discussion list for the FieldTrip project Betreff: Re: [FieldTrip] I think you solved the problem Dear Jan, Apart from not being properly aligned, the segmentation looks a bit strange to me. I suspect that not everything went well here ;o). Could you try the following: specify cfg.coordsys = 'neuromag', both in your call to ft_volumerealign and in your call to ft_volumesegment. The cfg.coordinates for ft_volumesegment has to be removed (actually it is a deprecated option). The idea now is that mri-structures in fieldtrip can have a coordsys field, which allows for more transparent use of the different head coordinate system conventions. This takes away the need for intermediately coregistering the MRI in 'ctf'-convention, and would also take away your need to call headcoordinates later on. Best wishes, Jan-Mathijs On Apr 12, 2011, at 11:07 AM, wrote: Dear fieldtrip experts, I have two questions regarding head model creation. As noted on this thread, the volumesegment function was updated and I tested it for our Neuromag data. The segmentation is performed, but unfortunately it is not aligned with the MRI in my case. Here is the code I am using, the fieldtrip is from 9th April 2011. %read mri mri = ft_read_mri(subject_files.fiff_mri); mri.anatomy=double(mri.anatomy); %these are the fiducials for this subject taken from the Neuromag GUI for coregistration cfg=[]; cfg.fiducial.rpa=[136.35 142.80 31.96]; cfg.fiducial.nas=[47.84 101.80 100.10]; cfg.fiducial.lpa=[139.22 146.17 162.69]; %define the head coordinate system according to CTF conventions cfg.method='fiducial'; real_mri=ft_volumerealign(cfg,mri); %segment cfg = []; cfg.template = '/data/apps/spm/spm8/templates/T1.nii'; cfg.coordinates = 'ctf'; cfg.keepintermediate = 'no'; segmentedmri = ft_volumesegment(cfg, real_mri); %plot white matter test=segmentedmri; test.anatomy=real_mri.anatomy; cfg=[]; cfg.funparameter='white'; ft_sourceplot(cfg,test); %see attached picture The other issue regards back-transformation from CTF to Neuromag coordinates, which is necessary to make the head model fit the sensors. My idea was to create an appropriate transformation matrix like this. cd /net/avidya/storage/home/jan/fieldtrip-20110409/private ctfmat=headcoordinates(nas,lpa,rpa,'ctf'); nmmat=headcoordinates(nas,lpa,rpa,'neuromag'); ctf_to_nm=nmmat/ctfmat; And then to use it on the head model to bring it back into Neuromag coordinates: %create single shell, realistic headmodel cfg = []; hdm = ft_prepare_singleshell(cfg,segmentedmri); % transformation of headmodel into Neuromag space hdm.bnd.pnt=warp_apply(ctf_to_nm,hdm.bnd.pnt,'homogeneous'); Does this survive a sanity check? Best regards and thanks a lot, Jan ________________________________ Von: fieldtrip-bounces at donders.ru.nl [mailto:fieldtrip-bounces at donders.ru.nl] Im Auftrag von Jen Whitman Gesendet: Montag, 28. Februar 2011 22:32 An: Email discussion list for the FieldTrip project Betreff: [FieldTrip] I think you solved the problem I just checked, and when I re-ran my segmentation script with the new Fieldtrip in order to use an spm8 template image, coordinates got reversed. When I take out the calls to flipdim, they look fine (see attached screenshots). That certainly explains the meaningless results I was getting! Thanks for figuring that out, Jen On Mon, Feb 28, 2011 at 12:36 PM, jan-mathijs schoffelen wrote: Hi Jen, At first glance I have a comment on your script. You may need to explicitly check the alignment of your segmented volume and the original anatomy. A while a go some changes were made to ft_volumesegment, taking away the need to do the flipdim(flipdim... operations. I have posted this on the discussion list last January, but you may not have noticed. Anyway, if you now have used a recent version of FieldTrip for your segmentation both the location of your dipole grid, and the volume conductor model will not be adequately coregistered with the data, which may lead to funky results to begin with. That's most likely not related to the filetype in which the volumes are saved for later use. Best wishes, Jan-Mathijs On Feb 28, 2011, at 8:59 PM, Jen Whitman wrote: Hello Jan, When calling volumesegment, I specified 'ctf' as the coordinate system. The function I wrote to call volumesegment and prepare_singleshell for each subject and save the results is pasted below, with a couple of comments added for clarity. Over the weekend I tried specifying the coordinate system in the call to ft_volumenormalise as 'ctf' rather than 'spm', and commented out all the lines that said cfg.spmversion = 'spm8'; before calling a function. However, that created worse results, as each plot involved stripes of activation and empty voxels, suggesting that 'ctf' was not the correct coordinate system to specify. Thanks for the attached script. Looking in that the comments in that, I suspect that the solution to my problems will be to specify my filetype as nifti_img rather than nifti. I'll let you know how that goes. Jen ------------------------------------------------------------------------ ------------------------------------ % the variable subj is simply a string consisting of a subject number (e.g. 's05') which can be a folder name or part of a filename function [vol mri segmentedmri segmentedmriF]=call_volume_segment_function_spm8(subj) cfg.spmversion = 'spm8'; cfg.template = '/home/woodwardlab/spm8/templates/EPI.nii'; %cfg.template='/home/common/matlab/spm2/templates/T1.mnc'; cfg.name=[subj '_volseg']; cfg.write='yes'; cfg.smooth='no'; cfg.coordinates='ctf'; mri=read_mri([subj '/mri/' subj 'head.mri']); % made with CTF mriConverter and mriViewer software, after fiducials were marked segmentedmri = volumesegment(cfg, mri); segmentedmriF = segmentedmri; segmentedmriF.gray = flipdim(flipdim(flipdim(segmentedmriF.gray,3),2),1); segmentedmriF.white = flipdim(flipdim(flipdim(segmentedmriF.white,3),2),1); segmentedmriF.csf = flipdim(flipdim(flipdim(segmentedmriF.csf,3),2),1); segmentedmriF.transform = mri.transform; segmentedmriF.anatomy = mri.anatomy; cfg = []; cfg.spmversion = 'spm8'; vol = prepare_singleshell(cfg, segmentedmriF); eval(['save ' subj '/meg/mrisegmented.mat mri segmentedmri segmentedmriF vol']) On Sat, Feb 26, 2011 at 5:26 AM, jan-mathijs schoffelen wrote: Dear Jen, I do not manage to reproduce your issue, when only focussing on the ft_volumewrite and visualization part of your pipeline. See attached script, and yet an updated version of ft_volumewrite which you need to (hopefully) draw the same conclusion as I did. Yet, I only now realize that your question may pertain to the entire pipeline. It could be that something is going wrong there. I only see now that in the part of your script of which you reported that it gave 'good' results, you specify cfg.coordinates = 'ctf' before calling ft_volumenormalise. I assume this is correct, because the coordinate system your source-reconstructed data lives in, is according to the CTF-convention, and not according to the SPM-convention. On the other hand, the template for the spatial normalization lives in the SPM-coordinate system. In order for the spatial normalization to work OK, Fieldtrip tries to convert from one coordinate system to the other (once again, this is appropriate behaviour), before doing the actual normalization. It seems that at least in the script you sent along, in the final (not working version), you specified cfg.coordinates = 'spm' prior to calling ft_volumenormalise. This is probably wrong. Another important point that should be mentioned, is that the coordinate systems in which the functional data and the anatomical data live should be the same for the ft_sourceinterpolate to make sense. In other words, if your source reconstructed images are defined on a 3D grid of positions in CTF-space, the mri.transform of your anatomy should describe a transformation from voxel to CTF-space. I think you may want to revisit step by step this part of the pipeline; I don't think the problem lies in the writing. A final possibility of course is that Mricron is misbehaving... Best, Jan-Mathijs On Feb 25, 2011, at 9:44 PM, Jen Whitman wrote: Hi Jan, I tried re-running the analysis with the new script you sent me, and the latest version of fieldtrip (since I needed ft_get_opt as well), but the spm8 images being written are still producing flawed results. It's the same problem as I mentioned briefly in my previous post. I am not getting any error messages when writing these images. Rather, my problem is that the spm8 and spm2 results from the same data ought to be identical when viewed in mricron, but they're far from it. When I use mricron to look at the results from the spm8-format images, combined across participants to create a t-image, I just get a single 'blob' spanning roughly half the brain. In contrast, when I used spm2-format previously on the same data, the t-image was much more meaningful; a posterior alpha power decrease in a set of regions corresponding to the 'task-positive network' (a network found in the results of an fMRI version of my experiment, and widely reported in the fMRI literature). This failure to replicate the spm2 results when using spm8 images from the same data leads me to suspect that something is wrong with the coordinates for spm8 format. However, after experimenting extensively with different cfg options I still haven't identified the problem. If I my structural MRIs have been saved to .mri files using CTF's MRIConverter program, which cfg options, particularly for coordinates, template images, and filetypes, should I specify before calling the ft_volumesegment, ft_prepare_singleshell, ft_sourceinterpolate, ft_volumenormalise, and ft_volumewrite functions? Or should I be calling a different set of functions now? Thanks again for your help, Jen On Thu, Feb 24, 2011 at 10:07 AM, Jen Whitman wrote: Great, thanks! I'll start the analysis with your new script today and will let you know how it works out. Jen On Thu, Feb 24, 2011 at 4:44 AM, jan-mathijs schoffelen wrote: Dear Jen, I managed to reproduce your problem. The code was rather buggy and indeed ft_volumewrite did not behave as it should have. I now fixed it in the code and it should run fine now. Please find the updated file attached. It will be available on our ftp-server as of tonight. Please note that I updated the documentation, and changed the names of some of the options a bit. If you want to save your data in analyze-format, you should specify cfg.filetype = 'analyze_spm'. If you specify cfg.filetype = 'nifti', it should write out a volume to nifti-format, using SPM8. Best wishes, Jan-Mathijs On Feb 23, 2011, at 7:44 PM, Jen Whitman wrote: Dear Jan, Thanks for the quick reply. Yes, I have tried it out quite a few times now, experimenting with different settings in the cfgs. Below I'll paste the code I've been using to write images - first the code that successfully created spm2 images that produced good results, then the code used for creating nifti format images from the same data. The comments in this second part are at this point a bit of a maze of cfg options I've been changing back & forth. Any insights/suggestions regarding how to set up my cfgs to make this work would be greatly appreciated. Jen %%%%%%%% this code generated spm2-compatible images which did work (producing results that made sense). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% sourcetemp.avg.pow = (sourcetemp.avg.pow - sourcePre.avg.pow) ./ sourcePre.avg.pow; cfg = []; cfg.downsample = 2; sourcetempInt = sourceinterpolate(cfg, sourcetemp , mri); % projecting the plot onto a surface... cfg = []; cfg.coordinates = 'ctf'; cfg.template = '/home/common/matlab/spm2/templates/T1.mnc'; %this template is in MNI coordinates sourcetempIntN = volumenormalise(cfg, sourcetempInt); filename=[subj 'run' int2str(r) 'cond' int2str(cond) '_' int2str(f) 'HzWin' int2str(win) 'width750ms']; cfg=[]; cfg.parameter = 'avg.pow'; % string, describing the functional data to be processed, e.g. 'pow', 'coh' or 'nai' cfg.filename = [filename '.img']; %'testimageoutput_alphafreq'; % filename without the extension cfg.filetype = 'spm'; %'analyze', 'spm', 'vmp' or 'vmr' cfg.coordinates = 'spm'; %'spm, 'ctf' or empty for interactive (default = []) cfg.datatype = 'double'; %'float'; %'double'; %'bit1', 'uint8', 'int16', 'int32', 'float' or 'double' volumewrite(cfg, sourcetempIntN) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%% this code below hasn't worked yet... % I added cfg.spmversion = 'spm8'; % in the cfgs for the calls to ft_prepare_leadfield and ft_sourceanalysis, % and in the call to prepare_singleshell after calling volumesegment % I've also ensured that spm8 is the only spm version in my path, even in % the fieldtrip/external folder, and ensured that spm8 is installed properly % (files compiled correctly, etc..) sourcetemp.avg.pow = (sourcetemp.avg.pow - sourcePre.avg.pow) ./ sourcePre.avg.pow; filename=[subj 'run' int2str(r) 'cond' int2str(cond) '_' int2str(f) 'Hzspm8_FIXv9_Win' int2str(win) 'width750ms.img']; cfg = []; % cfg.coordinates = 'spm'; % changed for version 5 % cfg.spmversion = 'spm8'; % changed for version 5 cfg.downsample = 4; sourcetempInt = ft_sourceinterpolate(cfg, sourcetemp , mri); % projecting the plot onto a surface... cfg = []; %cfg.coordinates = 'spm'; % changed for version 5 %cfg.coordinates = 'ctf'; % changed for version 5 cfg.coordinates = 'spm'; % changed back to spm for version 9 cfg.downsample = 4; %cfg.spmversion = 'spm8'; % changed for version 6 (because this gets specified in volumewrite) cfg.template = 'Hmatrix/mask.nii.nii'; % basically equivalent to using spm8/templates/EPI.nii, except that mask.nii (produced from fmri data) has the desired voxel size % cfg.name = [filename]; % changed for version 6 %cfg.write= 'yes'; % changed for version 6 (when this was set to 'yes' there was no subsequent call to volumewrite) cfg.write= 'no'; % changed for version 6 sourcetempIntN = ft_volumenormalise(cfg, sourcetempInt); % this whole cfg and function call added for version 6 cfg=[]; % cfg.parameter = string, describing the functional data to be processed, e.g. 'pow', 'coh' or 'nai' % cfg.filename = filename without the extension % cfg.filetype = 'analyze', 'spm', 'vmp' or 'vmr' % cfg.vmpversion = 1 or 2 (default) version of the vmp-format to use % cfg.coordinates = 'spm, 'ctf' or empty for interactive (default = []) cfg.parameter='pow'; cfg.filename=filename; cfg.filetype = 'spm'; cfg.spmversion = 'SPM8'; % capitalized after first error message from vers 6 % cfg.dataformat='nifti'; % added after first error message from vers 6 % commented out after 2nd error message from vers 6 %cfg.vmpversion=2; % this is a filetype, like spm, so don't need to specify unless cfg.filetyp='vmp' cfg.coordinates='spm'; ft_volumewrite(cfg,sourcetempIntN); On Wed, Feb 23, 2011 at 7:50 AM, jan-mathijs schoffelen wrote: Dear Jen, I notice that indeed in the documentation section of ft_write_volume there is a FIXME behind nifti. Yet, nifti format seems to be supported by ft_write_volume (at least in a recent version of fieldtrip). Did you try it at all (and ran into problems) or were you held back by the FIXME statement? Could you just try it out using a recent fieldtrip function? Thanks and best wishes Jan-Mathijs On Feb 23, 2011, at 2:21 AM, Jen Whitman wrote: Hello, While writing beamformed images to spm2 format in a previous version of fieldtrip (now lost due to a computer crash), I was able to get nice-looking results; networks of brain regions consistent with existing literature. When I try to write images from the same dataset and the same analysis to spm8 format, my results (t-images computed across subjects) end up being single clusters spanning large sections of the brain (e.g. a 'blob' spanning all of one hemisphere but not the other). Unfortunately, some aspects of my planned data analyses cannot be performed on spm2 images, so I have to find a way of writing to successfully to nifti format. I just noticed that in the comments in the ft_write_volume function, which I am calling via ft_volumewrite, it says 'FIXME' next to nifti under the list of supported dataformats. Is there by any chance a patch out there for writing nifti images? Thanks! _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 -------------- next part -------------- An HTML attachment was scrubbed... URL: From lieneke.janssen at student.ru.nl Tue Apr 12 14:59:46 2011 From: lieneke.janssen at student.ru.nl (Lieneke. Janssen) Date: Tue, 12 Apr 2011 14:59:46 +0200 (CEST) Subject: [FieldTrip] ft_timelockanalysis, trial selection In-Reply-To: <1126858119.313915.1302612752580.JavaMail.root@monoceros.zimbra.ru.nl> Message-ID: <812169884.314034.1302613186099.JavaMail.root@monoceros.zimbra.ru.nl> Dear fieldtrippers, Previously, I could do time-locked analysis on select trials only. Today however, I get an error (same script and similar data) which you can see below. After quite some debugging attempts, going into the other functions involved and googling a bit I think I found a little bug in the private function [data] = selfromraw(data, varargin{:}) that is called by ft_selectdata. In this private function keyval(key,varargin{:}) is not yet changed into keyval(key,varargin). See log messeage at http://code.google.com/p/fieldtrip/source/detail?spec=svn3292&r=3292. If you run keyval(key,varargin{:}) on the command line you get the error, if you run keyval(key,varargin) on the command line you don't. Hopefully, somebody can help me with this :). Thanks! Best, Lieneke --------------------------------------------------------------- ??? Error using ==> keyval the first input argument should be a cell-array or structure Error in ==> selfromraw at 3 selrpt = keyval('rpt', varargin{:}); selectrpt = ~isempty(strmatch(varargin(cellfun(@ischar, varargin)), 'rpt')); Error in ==> ft_selectdata at 508 data = selfromraw(data, 'rpt', selrpt); Error in ==> ft_timelockanalysis at 148 data = ft_selectdata(data, 'rpt', cfg.trials); Error in ==> lj_main_rfm at 255 timelock_out = ft_timelockanalysis(cfg, resampled_data); From jan.schoffelen at donders.ru.nl Tue Apr 12 15:29:44 2011 From: jan.schoffelen at donders.ru.nl (jan-mathijs schoffelen) Date: Tue, 12 Apr 2011 15:29:44 +0200 Subject: [FieldTrip] ft_timelockanalysis, trial selection In-Reply-To: <812169884.314034.1302613186099.JavaMail.root@monoceros.zimbra.ru.nl> References: <812169884.314034.1302613186099.JavaMail.root@monoceros.zimbra.ru.nl> Message-ID: <3CF7EDEF-9024-48EC-94EA-56380E5FBD44@donders.ru.nl> Dear Lieneke, Thanks for your detailed report on this bug, and sorry for the inconvenience. I fixed it now, and it should become available to you (at /home/common/matlab/fieldtrip) within the coming 15 minutes or so. If you are using an external version, it will become available on the ftp-server tonight. Best wishes, Jan-Mathijs On Apr 12, 2011, at 2:59 PM, Lieneke. Janssen wrote: > Dear fieldtrippers, > > Previously, I could do time-locked analysis on select trials only. > Today however, I get an error (same script and similar data) which > you can see below. > > After quite some debugging attempts, going into the other functions > involved and googling a bit I think I found a little bug in the > private function [data] = selfromraw(data, varargin{:}) that is > called by ft_selectdata. > > In this private function keyval(key,varargin{:}) is not yet changed > into keyval(key,varargin). See log messeage at http://code.google.com/p/fieldtrip/source/detail?spec=svn3292&r=3292 > . > > If you run keyval(key,varargin{:}) on the command line you get the > error, if you run keyval(key,varargin) on the command line you don't. > > Hopefully, somebody can help me with this :). > Thanks! > > Best, > Lieneke > > > > > > > > > --------------------------------------------------------------- > ??? Error using ==> keyval > the first input argument should be a cell-array or structure > > Error in ==> selfromraw at 3 > selrpt = keyval('rpt', varargin{:}); selectrpt = > ~isempty(strmatch(varargin(cellfun(@ischar, varargin)), 'rpt')); > > Error in ==> ft_selectdata at 508 > data = selfromraw(data, 'rpt', selrpt); > > Error in ==> ft_timelockanalysis at 148 > data = ft_selectdata(data, 'rpt', cfg.trials); > > Error in ==> lj_main_rfm at 255 > timelock_out = ft_timelockanalysis(cfg, resampled_data); > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 From jan.schoffelen at donders.ru.nl Tue Apr 12 15:38:24 2011 From: jan.schoffelen at donders.ru.nl (jan-mathijs schoffelen) Date: Tue, 12 Apr 2011 15:38:24 +0200 Subject: [FieldTrip] Fwd: ft_selectdata References: Message-ID: <9ED1C053-FFB7-4795-9AD0-BED55E003E3D@donders.ru.nl> Dear Mark, I forward your message to the list in order for other people to also benefit from it (regarding your question: at least those who can read Dutch: ;o) ). Your question relates to an error you get, when calling ft_selectdata using a variable 'Data', which I assume to be the output of ft_timelockgrandaverage. Moreover, I assume you are using a not up-to-date version of FieldTrip, because your variable 'Data' contains both and .avg-field, and in .individual-field. This makes the data-object ambiguous with respect to the 'dimord'; for the .individual-field the 'dimord' should be 'subj_chan_time', and for the .avg-field the 'dimord' should be 'chan_time'. This is why we recently changed ft_timelockgrandaverage to only output the .individual-field, if cfg.keepindividual = 'yes'; Moreover, we recently fixed a small bug related to ft_selectdata not being able to correctly deal with the 'dimord'-string 'subj'. In other words, could you please update to a recent version of FieldTrip and try again? Best wishes, Jan-Mathijs Begin forwarded message: > From: Mark Noordenbos > Date: April 12, 2011 10:37:05 AM GMT+02:00 > To: j.schoffelen at donders.ru.nl > Subject: !!!!!SPAM!!!!! ft_selectdata > > Beste Jan-Mathijs, > > Momenteel gebruik ik Fieldtrip voor het analyseren van timelocked > EEG data. Nu wil ik op basis van cluster analyse kijken of er een > verschil tussen de linker en rechter hemisfeer, maar volgens mij zit > deze optie helaas alleen in ft_sourcestatistics. Daarom probeer ik > met ft_selectdata de data te selecteren voor de linker en rechter > hemisfeer op basis van channels. Daarna heb ik de labels in de ene > dataset aangepast omdat er anders geen channels worden gevonden die > overeenkomen. > > chan_left = {'F7','F3', 'FC5','FC1','T7','C3','CP1','P7','P3','O1'}; > chan_right = {'F8','F4', 'FC6','FC2','T8','C4','CP2','P8','P4','O2'}; > Data_left = ft_selectdata(Data, 'channel', chan_left); > Data_right = ft_selectdata(Data, 'channel', chan_right); > Data_right.label= {'F3','F7','FC1','FC5','C3','CP1','P3','P7','O2'}; > > Maar met ft_selectdata krijg ik steeds de volgende foutmelding: > > ??? Attempted to access n(1); index out of bounds because numel(n)=0. > > Error in ==> dimlength at 115 > if ~all(n==n(1)) > > Error in ==> dimlength at 46 > n{k}(i) = dimlength(data, dimtok{i}, fn{k}); > > Error in ==> seloverdim at 39 > [reduceddim, fntmp] = dimlength(data); > > Error in ==> ft_selectdata at 562 > if selectrpt, data = seloverdim(data, 'rpt', selrpt, fb); end > > > Kan het kloppen dat ft_selectdata niet overweg kan met > Data.individuals want als ik dit verwijder en Data.dimord verander > in chan_time dan werkt ft_selectdata wel. > > Data bestaat uit: > > label: {30x1 cell} > fsample: 500 > avg: [30x350 double] > var: [30x350 double] > time: [1x350 double] > individual: [31x30x350 double] > dimord: 'subj_chan_time' > cfg: [1x1 struct] > > > > Wellicht doe ik iets verkeerd of is er misschien een andere (betere) > methode voor het vergelijken van hemisferen voor timelocked EEG data. > > Alvast bedankt, > Mark Noordenbos > > -- > Mark Noordenbos, MSc > > Radboud University Nijmegen > Behavioural Science Institute > > P.O. Box 9104, Room A05.36 > 6500 HE Nijmegen > The Netherlands > > Email: m.noordenbos at bsi.ru.nl > Telephone: +31 24 3612070 > Fax: +31 24 3616211 > > http://www.ru.nl Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 -------------- next part -------------- An HTML attachment was scrubbed... URL: From lieneke.janssen at student.ru.nl Tue Apr 12 16:34:32 2011 From: lieneke.janssen at student.ru.nl (Lieneke. Janssen) Date: Tue, 12 Apr 2011 16:34:32 +0200 (CEST) Subject: [FieldTrip] ft_timelockanalysis, trial selection In-Reply-To: <3CF7EDEF-9024-48EC-94EA-56380E5FBD44@donders.ru.nl> Message-ID: <1222293418.316034.1302618872718.JavaMail.root@monoceros.zimbra.ru.nl> Perfect, thanks! Tot zover m'n omslachtige trial selectie. Groetjes, Lieneke ----- "jan-mathijs schoffelen" wrote: > From: "jan-mathijs schoffelen" > To: "Email discussion list for the FieldTrip project" > Sent: Tuesday, April 12, 2011 3:29:44 PM > Subject: Re: [FieldTrip] ft_timelockanalysis, trial selection > > Dear Lieneke, > > Thanks for your detailed report on this bug, and sorry for the > inconvenience. I fixed it now, and it should become available to you > > (at /home/common/matlab/fieldtrip) within the coming 15 minutes or so. > > If you are using an external version, it will become available on the > > ftp-server tonight. > > Best wishes, > > Jan-Mathijs > > > > On Apr 12, 2011, at 2:59 PM, Lieneke. Janssen wrote: > > > Dear fieldtrippers, > > > > Previously, I could do time-locked analysis on select trials only. > > > Today however, I get an error (same script and similar data) which > > > you can see below. > > > > After quite some debugging attempts, going into the other functions > > > involved and googling a bit I think I found a little bug in the > > private function [data] = selfromraw(data, varargin{:}) that is > > called by ft_selectdata. > > > > In this private function keyval(key,varargin{:}) is not yet changed > > > into keyval(key,varargin). See log messeage at > http://code.google.com/p/fieldtrip/source/detail?spec=svn3292&r=3292 > > . > > > > If you run keyval(key,varargin{:}) on the command line you get the > > > error, if you run keyval(key,varargin) on the command line you > don't. > > > > Hopefully, somebody can help me with this :). > > Thanks! > > > > Best, > > Lieneke > > > > > > > > > > > > > > > > > > --------------------------------------------------------------- > > ??? Error using ==> keyval > > the first input argument should be a cell-array or structure > > > > Error in ==> selfromraw at 3 > > selrpt = keyval('rpt', varargin{:}); selectrpt = > > ~isempty(strmatch(varargin(cellfun(@ischar, varargin)), 'rpt')); > > > > Error in ==> ft_selectdata at 508 > > data = selfromraw(data, 'rpt', selrpt); > > > > Error in ==> ft_timelockanalysis at 148 > > data = ft_selectdata(data, 'rpt', cfg.trials); > > > > Error in ==> lj_main_rfm at 255 > > timelock_out = ft_timelockanalysis(cfg, resampled_data); > > _______________________________________________ > > fieldtrip mailing list > > fieldtrip at donders.ru.nl > > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > > Dr. J.M. (Jan-Mathijs) Schoffelen > Donders Institute for Brain, Cognition and Behaviour, > Centre for Cognitive Neuroimaging, > Radboud University Nijmegen, The Netherlands > J.Schoffelen at donders.ru.nl > Telephone: 0031-24-3614793 > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip From sherrykhan78 at gmail.com Tue Apr 12 20:06:32 2011 From: sherrykhan78 at gmail.com (Sheraz Khan) Date: Tue, 12 Apr 2011 14:06:32 -0400 Subject: [FieldTrip] Postdoctoral Fellowship: Multimodal Neuroimaging -MGH/Harvard Medical School Message-ID: Postdoctoral Fellowship: Multimodal Neuroimaging -MGH/Harvard Medical School Job Description A postdoctoral position is available with the TRANSCEND Research Program ( www.transcendresearch.org) at the Martinos Center for Biomedical Imaging in Charlestown, MA (www.martinos.org) which is affiliated with the Massachusetts General Hospital, Harvard Medical School and MIT. We are seeking a candidate with a strong basis in magnetic resonance imaging. Emphasis will be on MRI (DTI, spectroscopy, morphometry, ASL as well as resting state fMRI), and on co-registering MEG with MRI. This position will involve analysis of existing multimodal imaging data and collection of new data. The emphasis of the postdoctoral fellowship will be analysis of existing datasets with secondary activity in piloting data for new studies. It will involve working closely with a multidisciplinary team and with children, and will also involve some research oriented analysis of data collected for clinical purposes. After initial phase-in, ample opportunity will also be provided to the candidate to self-explore and lead research. Datasets to be analyzed include: MRI (including DTI and 1H-spectroscopy) and MEG data on 6-12 and teenage matched autism spectrum and control subjects with phenotyping data MRI data ( (morphometry, DTI, spectroscopy) plus laboratory and phenotyping data) on 70 children with autism plus epilepsy and/or mitochondrial dysfunction, along with one or more overnight EEGs on each patient data from children ages 2-10 with and without autism. Overall objectives: To perform multimodal analyses of research and clinical research data, to develop new approaches for performing these analyses, and to design pipelines for data analysis. To write papers and grants which will be high priorities all along the way and will be actively supported by senior faculty. To take advantage of the world class faculty and facilities of the Martinos Center for Biomedical Imaging to perform the above activities to their maximal potential. The program’s emphasis is on pathophysiologically grounded brain research and application of advanced imaging acquisition and analysis techniques to neurological and sensory aspects of autism spectrum disorders. Requirements: Candidates must have PhD in neuroscience, physics, biomedical engineering, electrical engineering, computer science or other related fields. Prior experience in MRI analysis is required. Experience with EEG will be an added advantage. Salary will be consistent with Massachusetts General Hospital, Harvard Medical School policies for Postdoctoral trainees and will range between $45,000 to $55,000 depending upon qualifications and experience. Compensation also includes full staff benefits, including health insurance, and vacation time. Contact: Interested applicants may send a CV and statement of interest addressing background and specific pertinence of the candidate’s interest to Dr. Martha R. Herbert at mherbert1 at partners.org and cc transcend at partners.org. Applications will be considered until the position is filled. -------------- next part -------------- An HTML attachment was scrubbed... URL: From Jan.Hirschmann at med.uni-duesseldorf.de Tue Apr 12 20:49:10 2011 From: Jan.Hirschmann at med.uni-duesseldorf.de (Jan.Hirschmann at med.uni-duesseldorf.de) Date: Tue, 12 Apr 2011 20:49:10 +0200 Subject: [FieldTrip] I think you solved the problem In-Reply-To: <7B5CA863-D143-404C-BCB9-805AA6E6E546@donders.ru.nl> References: <72E993C35FB11743B79FF9286E5B6D8B02676142@Mail2-UKD.VMED.UKD> <7B5CA863-D143-404C-BCB9-805AA6E6E546@donders.ru.nl> Message-ID: <72E993C35FB11743B79FF9286E5B6D8B02676264@Mail2-UKD.VMED.UKD> Dear Jan-Mathijs, sorry, I think I was a bit too enthusiastic when I said everything worked out wonderfully. It worked only once. After an afternoon of confusion I concluded that on my first try I must have misspelled cfg.coordsys='neuromag' on my calls to ft_volumerealign and ft_volumesegment. In fact, the segmentation looks really bad with these settings. What works for me is written underneath: mri = ft_read_mri('....fif'); hdr=ft_read_header('...fif'); mri.anatomy=double(mri.anatomy); %this is taken from the Neuromag GUI for MRI-MEG Integration cfg=[]; cfg.fiducial.rpa=[136.35 142.80 31.96]; cfg.fiducial.nas=[47.84 101.80 100.10]; cfg.fiducial.lpa=[139.22 146.17 162.69]; %go from neuromag voxel to neuromag head coordinates cfg.coordsys='neuromag'; cfg.method='fiducial'; real_mri=ft_volumerealign(cfg,mri); %taking real_mri with its coordsys field will not work, so I take mri mri.transform=real_mri.transform; cfg = []; cfg.keepintermediate = 'no'; cfg.write = 'no'; segmentedmri = ft_volumesegment(cfg, mri); Before segmentation the function shows some kind of brain (pic 1). When segmentation is done the segmented brain looks good (pic 2) but the brain does not fit the helmet (pic 3). It is looking at its feet as if it dropped some pocket change. Do you know what is going on? Thanks, jan ________________________________ Von: fieldtrip-bounces at donders.ru.nl [mailto:fieldtrip-bounces at donders.ru.nl] Im Auftrag von jan-mathijs schoffelen Gesendet: Dienstag, 12. April 2011 12:11 An: Email discussion list for the FieldTrip project Betreff: Re: [FieldTrip] I think you solved the problem Dear Jan, Apart from not being properly aligned, the segmentation looks a bit strange to me. I suspect that not everything went well here ;o). Could you try the following: specify cfg.coordsys = 'neuromag', both in your call to ft_volumerealign and in your call to ft_volumesegment. The cfg.coordinates for ft_volumesegment has to be removed (actually it is a deprecated option). The idea now is that mri-structures in fieldtrip can have a coordsys field, which allows for more transparent use of the different head coordinate system conventions. This takes away the need for intermediately coregistering the MRI in 'ctf'-convention, and would also take away your need to call headcoordinates later on. Best wishes, Jan-Mathijs On Apr 12, 2011, at 11:07 AM, < Jan.Hirschmann at med.uni-duesseldorf.de> wrote: Dear fieldtrip experts, I have two questions regarding head model creation. As noted on this thread, the volumesegment function was updated and I tested it for our Neuromag data. The segmentation is performed, but unfortunately it is not aligned with the MRI in my case. Here is the code I am using, the fieldtrip is from 9th April 2011. %read mri mri = ft_read_mri(subject_files.fiff_mri); mri.anatomy=double(mri.anatomy); %these are the fiducials for this subject taken from the Neuromag GUI for coregistration cfg=[]; cfg.fiducial.rpa=[136.35 142.80 31.96]; cfg.fiducial.nas=[47.84 101.80 100.10]; cfg.fiducial.lpa=[139.22 146.17 162.69]; %define the head coordinate system according to CTF conventions cfg.method='fiducial'; real_mri=ft_volumerealign(cfg,mri); %segment cfg = []; cfg.template = '/data/apps/spm/spm8/templates/T1.nii'; cfg.coordinates = 'ctf'; cfg.keepintermediate = 'no'; segmentedmri = ft_volumesegment(cfg, real_mri); %plot white matter test=segmentedmri; test.anatomy=real_mri.anatomy; cfg=[]; cfg.funparameter='white'; ft_sourceplot(cfg,test); %see attached picture The other issue regards back-transformation from CTF to Neuromag coordinates, which is necessary to make the head model fit the sensors. My idea was to create an appropriate transformation matrix like this. cd /net/avidya/storage/home/jan/fieldtrip-20110409/private ctfmat=headcoordinates(nas,lpa,rpa,'ctf'); nmmat=headcoordinates(nas,lpa,rpa,'neuromag'); ctf_to_nm=nmmat/ctfmat; And then to use it on the head model to bring it back into Neuromag coordinates: %create single shell, realistic headmodel cfg = []; hdm = ft_prepare_singleshell(cfg,segmentedmri); % transformation of headmodel into Neuromag space hdm.bnd.pnt=warp_apply(ctf_to_nm,hdm.bnd.pnt,'homogeneous'); Does this survive a sanity check? Best regards and thanks a lot, Jan ________________________________ Von: fieldtrip-bounces at donders.ru.nl [ mailto:fieldtrip-bounces at donders.ru.nl] Im Auftrag von Jen Whitman Gesendet: Montag, 28. Februar 2011 22:32 An: Email discussion list for the FieldTrip project Betreff: [FieldTrip] I think you solved the problem I just checked, and when I re-ran my segmentation script with the new Fieldtrip in order to use an spm8 template image, coordinates got reversed. When I take out the calls to flipdim, they look fine (see attached screenshots). That certainly explains the meaningless results I was getting! Thanks for figuring that out, Jen On Mon, Feb 28, 2011 at 12:36 PM, jan-mathijs schoffelen < jan.schoffelen at donders.ru.nl> wrote: Hi Jen, At first glance I have a comment on your script. You may need to explicitly check the alignment of your segmented volume and the original anatomy. A while a go some changes were made to ft_volumesegment, taking away the need to do the flipdim(flipdim... operations. I have posted this on the discussion list last January, but you may not have noticed. Anyway, if you now have used a recent version of FieldTrip for your segmentation both the location of your dipole grid, and the volume conductor model will not be adequately coregistered with the data, which may lead to funky results to begin with. That's most likely not related to the filetype in which the volumes are saved for later use. Best wishes, Jan-Mathijs On Feb 28, 2011, at 8:59 PM, Jen Whitman wrote: Hello Jan, When calling volumesegment, I specified 'ctf' as the coordinate system. The function I wrote to call volumesegment and prepare_singleshell for each subject and save the results is pasted below, with a couple of comments added for clarity. Over the weekend I tried specifying the coordinate system in the call to ft_volumenormalise as 'ctf' rather than 'spm', and commented out all the lines that said cfg.spmversion = 'spm8'; before calling a function. However, that created worse results, as each plot involved stripes of activation and empty voxels, suggesting that 'ctf' was not the correct coordinate system to specify. Thanks for the attached script. Looking in that the comments in that, I suspect that the solution to my problems will be to specify my filetype as nifti_img rather than nifti. I'll let you know how that goes. Jen ------------------------------------------------------------------------ ------------------------------------ % the variable subj is simply a string consisting of a subject number (e.g. 's05') which can be a folder name or part of a filename function [vol mri segmentedmri segmentedmriF]=call_volume_segment_function_spm8(subj) cfg.spmversion = 'spm8'; cfg.template = '/home/woodwardlab/spm8/templates/EPI.nii'; %cfg.template='/home/common/matlab/spm2/templates/T1.mnc'; cfg.name=[subj '_volseg']; cfg.write='yes'; cfg.smooth='no'; cfg.coordinates='ctf'; mri=read_mri([subj '/mri/' subj 'head.mri']); % made with CTF mriConverter and mriViewer software, after fiducials were marked segmentedmri = volumesegment(cfg, mri); segmentedmriF = segmentedmri; segmentedmriF.gray = flipdim(flipdim(flipdim(segmentedmriF.gray,3),2),1); segmentedmriF.white = flipdim(flipdim(flipdim(segmentedmriF.white,3),2),1); segmentedmriF.csf = flipdim(flipdim(flipdim(segmentedmriF.csf,3),2),1); segmentedmriF.transform = mri.transform; segmentedmriF.anatomy = mri.anatomy; cfg = []; cfg.spmversion = 'spm8'; vol = prepare_singleshell(cfg, segmentedmriF); eval(['save ' subj '/meg/mrisegmented.mat mri segmentedmri segmentedmriF vol']) On Sat, Feb 26, 2011 at 5:26 AM, jan-mathijs schoffelen < jan.schoffelen at donders.ru.nl> wrote: Dear Jen, I do not manage to reproduce your issue, when only focussing on the ft_volumewrite and visualization part of your pipeline. See attached script, and yet an updated version of ft_volumewrite which you need to (hopefully) draw the same conclusion as I did. Yet, I only now realize that your question may pertain to the entire pipeline. It could be that something is going wrong there. I only see now that in the part of your script of which you reported that it gave 'good' results, you specify cfg.coordinates = 'ctf' before calling ft_volumenormalise. I assume this is correct, because the coordinate system your source-reconstructed data lives in, is according to the CTF-convention, and not according to the SPM-convention. On the other hand, the template for the spatial normalization lives in the SPM-coordinate system. In order for the spatial normalization to work OK, Fieldtrip tries to convert from one coordinate system to the other (once again, this is appropriate behaviour), before doing the actual normalization. It seems that at least in the script you sent along, in the final (not working version), you specified cfg.coordinates = 'spm' prior to calling ft_volumenormalise. This is probably wrong. Another important point that should be mentioned, is that the coordinate systems in which the functional data and the anatomical data live should be the same for the ft_sourceinterpolate to make sense. In other words, if your source reconstructed images are defined on a 3D grid of positions in CTF-space, the mri.transform of your anatomy should describe a transformation from voxel to CTF-space. I think you may want to revisit step by step this part of the pipeline; I don't think the problem lies in the writing. A final possibility of course is that Mricron is misbehaving... Best, Jan-Mathijs On Feb 25, 2011, at 9:44 PM, Jen Whitman wrote: Hi Jan, I tried re-running the analysis with the new script you sent me, and the latest version of fieldtrip (since I needed ft_get_opt as well), but the spm8 images being written are still producing flawed results. It's the same problem as I mentioned briefly in my previous post. I am not getting any error messages when writing these images. Rather, my problem is that the spm8 and spm2 results from the same data ought to be identical when viewed in mricron, but they're far from it. When I use mricron to look at the results from the spm8-format images, combined across participants to create a t-image, I just get a single 'blob' spanning roughly half the brain. In contrast, when I used spm2-format previously on the same data, the t-image was much more meaningful; a posterior alpha power decrease in a set of regions corresponding to the 'task-positive network' (a network found in the results of an fMRI version of my experiment, and widely reported in the fMRI literature). This failure to replicate the spm2 results when using spm8 images from the same data leads me to suspect that something is wrong with the coordinates for spm8 format. However, after experimenting extensively with different cfg options I still haven't identified the problem. If I my structural MRIs have been saved to .mri files using CTF's MRIConverter program, which cfg options, particularly for coordinates, template images, and filetypes, should I specify before calling the ft_volumesegment, ft_prepare_singleshell, ft_sourceinterpolate, ft_volumenormalise, and ft_volumewrite functions? Or should I be calling a different set of functions now? Thanks again for your help, Jen On Thu, Feb 24, 2011 at 10:07 AM, Jen Whitman wrote: Great, thanks! I'll start the analysis with your new script today and will let you know how it works out. Jen On Thu, Feb 24, 2011 at 4:44 AM, jan-mathijs schoffelen < jan.schoffelen at donders.ru.nl> wrote: Dear Jen, I managed to reproduce your problem. The code was rather buggy and indeed ft_volumewrite did not behave as it should have. I now fixed it in the code and it should run fine now. Please find the updated file attached. It will be available on our ftp-server as of tonight. Please note that I updated the documentation, and changed the names of some of the options a bit. If you want to save your data in analyze-format, you should specify cfg.filetype = 'analyze_spm'. If you specify cfg.filetype = 'nifti', it should write out a volume to nifti-format, using SPM8. Best wishes, Jan-Mathijs On Feb 23, 2011, at 7:44 PM, Jen Whitman wrote: Dear Jan, Thanks for the quick reply. Yes, I have tried it out quite a few times now, experimenting with different settings in the cfgs. Below I'll paste the code I've been using to write images - first the code that successfully created spm2 images that produced good results, then the code used for creating nifti format images from the same data. The comments in this second part are at this point a bit of a maze of cfg options I've been changing back & forth. Any insights/suggestions regarding how to set up my cfgs to make this work would be greatly appreciated. Jen %%%%%%%% this code generated spm2-compatible images which did work (producing results that made sense). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% sourcetemp.avg.pow = (sourcetemp.avg.pow - sourcePre.avg.pow) ./ sourcePre.avg.pow; cfg = []; cfg.downsample = 2; sourcetempInt = sourceinterpolate(cfg, sourcetemp , mri); % projecting the plot onto a surface... cfg = []; cfg.coordinates = 'ctf'; cfg.template = '/home/common/matlab/spm2/templates/T1.mnc'; %this template is in MNI coordinates sourcetempIntN = volumenormalise(cfg, sourcetempInt); filename=[subj 'run' int2str(r) 'cond' int2str(cond) '_' int2str(f) 'HzWin' int2str(win) 'width750ms']; cfg=[]; cfg.parameter = 'avg.pow'; % string, describing the functional data to be processed, e.g. 'pow', 'coh' or 'nai' cfg.filename = [filename '.img']; %'testimageoutput_alphafreq'; % filename without the extension cfg.filetype = 'spm'; %'analyze', 'spm', 'vmp' or 'vmr' cfg.coordinates = 'spm'; %'spm, 'ctf' or empty for interactive (default = []) cfg.datatype = 'double'; %'float'; %'double'; %'bit1', 'uint8', 'int16', 'int32', 'float' or 'double' volumewrite(cfg, sourcetempIntN) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%% this code below hasn't worked yet... % I added cfg.spmversion = 'spm8'; % in the cfgs for the calls to ft_prepare_leadfield and ft_sourceanalysis, % and in the call to prepare_singleshell after calling volumesegment % I've also ensured that spm8 is the only spm version in my path, even in % the fieldtrip/external folder, and ensured that spm8 is installed properly % (files compiled correctly, etc..) sourcetemp.avg.pow = (sourcetemp.avg.pow - sourcePre.avg.pow) ./ sourcePre.avg.pow; filename=[subj 'run' int2str(r) 'cond' int2str(cond) '_' int2str(f) 'Hzspm8_FIXv9_Win' int2str(win) 'width750ms.img']; cfg = []; % cfg.coordinates = 'spm'; % changed for version 5 % cfg.spmversion = 'spm8'; % changed for version 5 cfg.downsample = 4; sourcetempInt = ft_sourceinterpolate(cfg, sourcetemp , mri); % projecting the plot onto a surface... cfg = []; %cfg.coordinates = 'spm'; % changed for version 5 %cfg.coordinates = 'ctf'; % changed for version 5 cfg.coordinates = 'spm'; % changed back to spm for version 9 cfg.downsample = 4; %cfg.spmversion = 'spm8'; % changed for version 6 (because this gets specified in volumewrite) cfg.template = 'Hmatrix/mask.nii.nii'; % basically equivalent to using spm8/templates/EPI.nii, except that mask.nii (produced from fmri data) has the desired voxel size % cfg.name = [filename]; % changed for version 6 %cfg.write= 'yes'; % changed for version 6 (when this was set to 'yes' there was no subsequent call to volumewrite) cfg.write= 'no'; % changed for version 6 sourcetempIntN = ft_volumenormalise(cfg, sourcetempInt); % this whole cfg and function call added for version 6 cfg=[]; % cfg.parameter = string, describing the functional data to be processed, e.g. 'pow', 'coh' or 'nai' % cfg.filename = filename without the extension % cfg.filetype = 'analyze', 'spm', 'vmp' or 'vmr' % cfg.vmpversion = 1 or 2 (default) version of the vmp-format to use % cfg.coordinates = 'spm, 'ctf' or empty for interactive (default = []) cfg.parameter='pow'; cfg.filename=filename; cfg.filetype = 'spm'; cfg.spmversion = 'SPM8'; % capitalized after first error message from vers 6 % cfg.dataformat='nifti'; % added after first error message from vers 6 % commented out after 2nd error message from vers 6 %cfg.vmpversion=2; % this is a filetype, like spm, so don't need to specify unless cfg.filetyp='vmp' cfg.coordinates='spm'; ft_volumewrite(cfg,sourcetempIntN); On Wed, Feb 23, 2011 at 7:50 AM, jan-mathijs schoffelen wrote: Dear Jen, I notice that indeed in the documentation section of ft_write_volume there is a FIXME behind nifti. Yet, nifti format seems to be supported by ft_write_volume (at least in a recent version of fieldtrip). Did you try it at all (and ran into problems) or were you held back by the FIXME statement? Could you just try it out using a recent fieldtrip function? Thanks and best wishes Jan-Mathijs On Feb 23, 2011, at 2:21 AM, Jen Whitman wrote: Hello, While writing beamformed images to spm2 format in a previous version of fieldtrip (now lost due to a computer crash), I was able to get nice-looking results; networks of brain regions consistent with existing literature. When I try to write images from the same dataset and the same analysis to spm8 format, my results (t-images computed across subjects) end up being single clusters spanning large sections of the brain (e.g. a 'blob' spanning all of one hemisphere but not the other). Unfortunately, some aspects of my planned data analyses cannot be performed on spm2 images, so I have to find a way of writing to successfully to nifti format. I just noticed that in the comments in the ft_write_volume function, which I am calling via ft_volumewrite, it says 'FIXME' next to nifti under the list of supported dataformats. Is there by any chance a patch out there for writing nifti images? Thanks! _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: pic1.png Type: image/png Size: 62738 bytes Desc: pic1.png URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: pic2.png Type: image/png Size: 106479 bytes Desc: pic2.png URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: pic3.png Type: image/png Size: 55419 bytes Desc: pic3.png URL: From jan.schoffelen at donders.ru.nl Tue Apr 12 21:17:59 2011 From: jan.schoffelen at donders.ru.nl (jan-mathijs schoffelen) Date: Tue, 12 Apr 2011 21:17:59 +0200 Subject: [FieldTrip] I think you solved the problem In-Reply-To: <72E993C35FB11743B79FF9286E5B6D8B02676264@Mail2-UKD.VMED.UKD> References: <72E993C35FB11743B79FF9286E5B6D8B02676142@Mail2-UKD.VMED.UKD> <7B5CA863-D143-404C-BCB9-805AA6E6E546@donders.ru.nl> <72E993C35FB11743B79FF9286E5B6D8B02676264@Mail2-UKD.VMED.UKD> Message-ID: Dear Jan, I suspect that your mri, as it comes out of ft_read_mri is already coregistered in neuromag space. After your realignment and after replacing mri.transform with real_mri.transform, the coordinate axes in your pic1 look strange. This I think causes the 'dropped pocket change'. What happens if you skip the ft_volumerealign step and call ft_volumesegment directly on the mri (with cfg.coordsys = 'neuromag', or, for what it's worth, without cfg.coordsys; in this case you will be able to verify the coordinate system)? Alternatively, if this doesn't work, could you replace mri.transform by eye(4) prior to calling ft_volumerealign and ft_volumesegment (both with cfg.coordsys = 'neuromag' and no further tampering with transformation matrices?). Thanks JM On Apr 12, 2011, at 8:49 PM, wrote: > Dear Jan-Mathijs, > > sorry, I think I was a bit too enthusiastic when I said everything > worked out wonderfully. It worked only once. After an afternoon of > confusion I concluded that on my first try I must have misspelled > cfg.coordsys=’neuromag’ on my calls to ft_volumerealign and > ft_volumesegment. In fact, the segmentation looks really bad with > these settings. What works for me is written underneath: > > mri = ft_read_mri('….fif'); > hdr=ft_read_header('…fif'); > mri.anatomy=double(mri.anatomy); > > %this is taken from the Neuromag GUI for MRI-MEG Integration > cfg=[]; > cfg.fiducial.rpa=[136.35 142.80 31.96]; > cfg.fiducial.nas=[47.84 101.80 100.10]; > cfg.fiducial.lpa=[139.22 146.17 162.69]; > > %go from neuromag voxel to neuromag head coordinates > cfg.coordsys='neuromag'; > cfg.method='fiducial'; > real_mri=ft_volumerealign(cfg,mri); > > %taking real_mri with its coordsys field will not work, so I take mri > mri.transform=real_mri.transform; > > cfg = []; > cfg.keepintermediate = 'no'; > cfg.write = 'no'; > segmentedmri = ft_volumesegment(cfg, mri); > > > Before segmentation the function shows some kind of brain (pic 1). > When segmentation is done the segmented brain looks good (pic 2) but > the brain does not fit the helmet (pic 3). It is looking at its feet > as if it dropped some pocket change. Do you know what is going on? > > Thanks, > jan > > Von: fieldtrip-bounces at donders.ru.nl [mailto:fieldtrip-bounces at donders.ru.nl > ] Im Auftrag von jan-mathijs schoffelen > Gesendet: Dienstag, 12. April 2011 12:11 > An: Email discussion list for the FieldTrip project > Betreff: Re: [FieldTrip] I think you solved the problem > > Dear Jan, > > Apart from not being properly aligned, the segmentation looks a bit > strange to me. I suspect that not everything went well here ;o). > Could you try the following: > > specify cfg.coordsys = 'neuromag', both in your call to > ft_volumerealign and in your call to ft_volumesegment. The > cfg.coordinates for ft_volumesegment has to be removed (actually it > is a deprecated option). The idea now is that mri-structures in > fieldtrip can have a coordsys field, which allows for more > transparent use of the different head coordinate system conventions. > This takes away the need for intermediately coregistering the MRI in > 'ctf'-convention, and would also take away your need to call > headcoordinates later on. > > Best wishes, > > Jan-Mathijs > > > On Apr 12, 2011, at 11:07 AM, duesseldorf.de> wrote: > > > Dear fieldtrip experts, > > I have two questions regarding head model creation. As noted on this > thread, the volumesegment function was updated and I tested it for > our Neuromag data. The segmentation is performed, but unfortunately > it is not aligned with the MRI in my case. Here is the code I am > using, the fieldtrip is from 9th April 2011. > > %read mri > mri = ft_read_mri(subject_files.fiff_mri); > mri.anatomy=double(mri.anatomy); > > %these are the fiducials for this subject taken from the Neuromag > GUI for coregistration > cfg=[]; > cfg.fiducial.rpa=[136.35 142.80 31.96]; > cfg.fiducial.nas=[47.84 101.80 100.10]; > cfg.fiducial.lpa=[139.22 146.17 162.69]; > > %define the head coordinate system according to CTF conventions > cfg.method='fiducial'; > real_mri=ft_volumerealign(cfg,mri); > > %segment > cfg = []; > cfg.template = '/data/apps/spm/spm8/templates/T1.nii'; > cfg.coordinates = 'ctf'; > cfg.keepintermediate = 'no'; > segmentedmri = ft_volumesegment(cfg, real_mri); > > %plot white matter > test=segmentedmri; > test.anatomy=real_mri.anatomy; > cfg=[]; > cfg.funparameter='white'; > ft_sourceplot(cfg,test); %see attached picture > > The other issue regards back-transformation from CTF to Neuromag > coordinates, which is necessary to make the head model fit the > sensors. My idea was to create an appropriate transformation matrix > like this. > > cd /net/avidya/storage/home/jan/fieldtrip-20110409/private > ctfmat=headcoordinates(nas,lpa,rpa,'ctf'); > nmmat=headcoordinates(nas,lpa,rpa,'neuromag'); > ctf_to_nm=nmmat/ctfmat; > > > And then to use it on the head model to bring it back into Neuromag > coordinates: > > %create single shell, realistic headmodel > cfg = []; > hdm = ft_prepare_singleshell(cfg,segmentedmri); > > % transformation of headmodel into Neuromag space > hdm.bnd.pnt=warp_apply(ctf_to_nm,hdm.bnd.pnt,'homogeneous'); > > Does this survive a sanity check? > > Best regards and thanks a lot, > > Jan > > > Von: fieldtrip-bounces at donders.ru.nl [mailto:fieldtrip-bounces at donders.ru.nl > ] Im Auftrag von Jen Whitman > Gesendet: Montag, 28. Februar 2011 22:32 > An: Email discussion list for the FieldTrip project > Betreff: [FieldTrip] I think you solved the problem > > I just checked, and when I re-ran my segmentation script with the > new Fieldtrip in order to use an spm8 template image, coordinates > got reversed. When I take out the calls to flipdim, they look fine > (see attached screenshots). That certainly explains the meaningless > results I was getting! > > Thanks for figuring that out, > > Jen > > On Mon, Feb 28, 2011 at 12:36 PM, jan-mathijs schoffelen > wrote: > Hi Jen, > > At first glance I have a comment on your script. You may need to > explicitly check the alignment of your segmented volume and the > original anatomy. A while a go some changes were made to > ft_volumesegment, taking away the need to do the flipdim(flipdim... > operations. I have posted this on the discussion list last January, > but you may not have noticed. > Anyway, if you now have used a recent version of FieldTrip for your > segmentation both the location of your dipole grid, and the volume > conductor model will not be adequately coregistered with the data, > which may lead to funky results to begin with. That's most likely > not related to the filetype in which the volumes are saved for later > use. > > Best wishes, > > Jan-Mathijs > > > > On Feb 28, 2011, at 8:59 PM, Jen Whitman wrote: > > > > Hello Jan, > > When calling volumesegment, I specified 'ctf' as the coordinate > system. The function I wrote to call volumesegment and > prepare_singleshell for each subject and save the results is pasted > below, with a couple of comments added for clarity. > Over the weekend I tried specifying the coordinate system in the > call to ft_volumenormalise as 'ctf' rather than 'spm', and commented > out all the lines that said cfg.spmversion = 'spm8'; before calling > a function. However, that created worse results, as each plot > involved stripes of activation and empty voxels, suggesting that > 'ctf' was not the correct coordinate system to specify. > > Thanks for the attached script. Looking in that the comments in > that, I suspect that the solution to my problems will be to specify > my filetype as nifti_img rather than nifti. I'll let you know how > that goes. > > Jen > > ------------------------------------------------------------------------------------------------------------ > % the variable subj is simply a string consisting of a subject > number (e.g. 's05') which can be a folder name or part of a filename > function [vol mri segmentedmri > segmentedmriF]=call_volume_segment_function_spm8(subj) > cfg.spmversion = 'spm8'; > cfg.template = '/home/woodwardlab/spm8/templates/EPI.nii'; > %cfg.template='/home/common/matlab/spm2/templates/T1.mnc'; > cfg.name=[subj '_volseg']; > cfg.write='yes'; > cfg.smooth='no'; > cfg.coordinates='ctf'; > mri=read_mri([subj '/mri/' subj 'head.mri']); % made with CTF > mriConverter and mriViewer software, after fiducials were marked > segmentedmri = volumesegment(cfg, mri); > segmentedmriF = segmentedmri; > segmentedmriF.gray = flipdim(flipdim(flipdim(segmentedmriF.gray,3), > 2),1); > segmentedmriF.white = flipdim(flipdim(flipdim(segmentedmriF.white,3), > 2),1); > segmentedmriF.csf = flipdim(flipdim(flipdim(segmentedmriF.csf,3), > 2),1); > segmentedmriF.transform = mri.transform; > segmentedmriF.anatomy = mri.anatomy; > cfg = []; > cfg.spmversion = 'spm8'; > vol = prepare_singleshell(cfg, segmentedmriF); > eval(['save ' subj '/meg/mrisegmented.mat mri segmentedmri > segmentedmriF vol']) > > > > > On Sat, Feb 26, 2011 at 5:26 AM, jan-mathijs schoffelen > wrote: > Dear Jen, > > I do not manage to reproduce your issue, when only focussing on the > ft_volumewrite and visualization part of your pipeline. See attached > script, and yet an updated version of ft_volumewrite which you need > to (hopefully) draw the same conclusion as I did. > Yet, I only now realize that your question may pertain to the entire > pipeline. It could be that something is going wrong there. > I only see now that in the part of your script of which you reported > that it gave 'good' results, you specify cfg.coordinates = 'ctf' > before calling ft_volumenormalise. I assume this is correct, because > the coordinate system your source-reconstructed data lives in, is > according to the CTF-convention, and not according to the SPM- > convention. On the other hand, the template for the spatial > normalization lives in the SPM-coordinate system. In order for the > spatial normalization to work OK, Fieldtrip tries to convert from > one coordinate system to the other (once again, this is appropriate > behaviour), before doing the actual normalization. It seems that at > least in the script you sent along, in the final (not working > version), you specified cfg.coordinates = 'spm' prior to calling > ft_volumenormalise. This is probably wrong. > Another important point that should be mentioned, is that the > coordinate systems in which the functional data and the anatomical > data live should be the same for the ft_sourceinterpolate to make > sense. In other words, if your source reconstructed images are > defined on a 3D grid of positions in CTF-space, the mri.transform of > your anatomy should describe a transformation from voxel to CTF-space. > I think you may want to revisit step by step this part of the > pipeline; I don't think the problem lies in the writing. > A final possibility of course is that Mricron is misbehaving... > > Best, > > Jan-Mathijs > > > > > > > On Feb 25, 2011, at 9:44 PM, Jen Whitman wrote: > > > > Hi Jan, > > I tried re-running the analysis with the new script you sent me, and > the latest version of fieldtrip (since I needed ft_get_opt as well), > but the spm8 images being written are still producing flawed > results. It's the same problem as I mentioned briefly in my previous > post. I am not getting any error messages when writing these images. > Rather, my problem is that the spm8 and spm2 results from the same > data ought to be identical when viewed in mricron, but they're far > from it. When I use mricron to look at the results from the spm8- > format images, combined across participants to create a t-image, I > just get a single 'blob' spanning roughly half the brain. In > contrast, when I used spm2-format previously on the same data, the t- > image was much more meaningful; a posterior alpha power decrease in > a set of regions corresponding to the 'task-positive network' (a > network found in the results of an fMRI version of my experiment, > and widely reported in the fMRI literature). > > This failure to replicate the spm2 results when using spm8 images > from the same data leads me to suspect that something is wrong with > the coordinates for spm8 format. However, after experimenting > extensively with different cfg options I still haven't identified > the problem. If I my structural MRIs have been saved to .mri files > using CTF's MRIConverter program, which cfg options, particularly > for coordinates, template images, and filetypes, should I specify > before calling the ft_volumesegment, ft_prepare_singleshell, > ft_sourceinterpolate, ft_volumenormalise, and ft_volumewrite > functions? Or should I be calling a different set of functions now? > > Thanks again for your help, > > Jen > > On Thu, Feb 24, 2011 at 10:07 AM, Jen Whitman > wrote: > Great, thanks! > > I'll start the analysis with your new script today and will let you > know how it works out. > > Jen > > On Thu, Feb 24, 2011 at 4:44 AM, jan-mathijs schoffelen > wrote: > Dear Jen, > > I managed to reproduce your problem. The code was rather buggy and > indeed ft_volumewrite did not behave as it should have. I now fixed > it in the code and it should run fine now. Please find the updated > file attached. It will be available on our ftp-server as of tonight. > Please note that I updated the documentation, and changed the names > of some of the options a bit. If you want to save your data in > analyze-format, you should specify cfg.filetype = 'analyze_spm'. If > you specify cfg.filetype = 'nifti', it should write out a volume to > nifti-format, using SPM8. > > Best wishes, > > Jan-Mathijs > > > > > > On Feb 23, 2011, at 7:44 PM, Jen Whitman wrote: > >> >> Dear Jan, >> >> Thanks for the quick reply. Yes, I have tried it out quite a few >> times now, experimenting with different settings in the cfgs. Below >> I'll paste the code I've been using to write images - first the >> code that successfully created spm2 images that produced good >> results, then the code used for creating nifti format images from >> the same data. The comments in this second part are at this point a >> bit of a maze of cfg options I've been changing back & forth. Any >> insights/suggestions regarding how to set up my cfgs to make this >> work would be greatly appreciated. >> >> Jen >> >> >> %%%%%%%% this code generated spm2-compatible images which did work >> (producing results that made sense). >> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% >> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% >> >> sourcetemp.avg.pow = (sourcetemp.avg.pow - >> sourcePre.avg.pow) ./ sourcePre.avg.pow; >> >> cfg = []; >> cfg.downsample = 2; >> sourcetempInt = sourceinterpolate(cfg, sourcetemp , mri); >> >> % projecting the plot onto a surface... >> cfg = []; >> cfg.coordinates = 'ctf'; >> cfg.template = '/home/common/matlab/spm2/templates/T1.mnc'; >> %this template is in MNI coordinates >> sourcetempIntN = volumenormalise(cfg, sourcetempInt); >> >> filename=[subj 'run' int2str(r) 'cond' int2str(cond) '_' >> int2str(f) 'HzWin' int2str(win) 'width750ms']; >> cfg=[]; >> cfg.parameter = 'avg.pow'; % string, describing the >> functional data to be processed, e.g. 'pow', 'coh' or 'nai' >> cfg.filename = [filename '.img']; >> %'testimageoutput_alphafreq'; % filename without the extension >> cfg.filetype = 'spm'; %'analyze', 'spm', 'vmp' or 'vmr' >> cfg.coordinates = 'spm'; %'spm, 'ctf' or empty for >> interactive (default = []) >> cfg.datatype = 'double'; %'float'; %'double'; %'bit1', 'uint8', >> 'int16', 'int32', 'float' or 'double' >> >> volumewrite(cfg, sourcetempIntN) >> >> >> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% >> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% >> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% >> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% >> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% >> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% >> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% >> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% >> %%%%% this code below hasn't worked yet... >> >> % I added cfg.spmversion = 'spm8'; >> % in the cfgs for the calls to ft_prepare_leadfield and >> ft_sourceanalysis, >> % and in the call to prepare_singleshell after calling volumesegment >> >> % I've also ensured that spm8 is the only spm version in my path, >> even in >> % the fieldtrip/external folder, and ensured that spm8 is installed >> properly >> % (files compiled correctly, etc..) >> >> sourcetemp.avg.pow = (sourcetemp.avg.pow - >> sourcePre.avg.pow) ./ sourcePre.avg.pow; >> >> filename=[subj 'run' int2str(r) 'cond' int2str(cond) '_' >> int2str(f) 'Hzspm8_FIXv9_Win' int2str(win) 'width750ms.img']; >> >> cfg = []; >> % cfg.coordinates = 'spm'; % changed for version 5 >> % cfg.spmversion = 'spm8'; % changed for version 5 >> cfg.downsample = 4; >> sourcetempInt = ft_sourceinterpolate(cfg, sourcetemp , mri); >> >> >> % projecting the plot onto a surface... >> cfg = []; >> %cfg.coordinates = 'spm'; % changed for version 5 >> %cfg.coordinates = 'ctf'; % changed for version 5 >> cfg.coordinates = 'spm'; % changed back to spm for version 9 >> cfg.downsample = 4; >> %cfg.spmversion = 'spm8'; % changed for version 6 (because this >> gets specified in volumewrite) >> cfg.template = 'Hmatrix/mask.nii.nii'; % basically equivalent >> to using spm8/templates/EPI.nii, except that mask.nii (produced >> from fmri data) has the desired voxel size >> % cfg.name = [filename]; % changed for version 6 >> %cfg.write= 'yes'; % changed for version 6 (when this was set >> to 'yes' there was no subsequent call to volumewrite) >> cfg.write= 'no'; % changed for version 6 >> sourcetempIntN = ft_volumenormalise(cfg, sourcetempInt); >> >> % this whole cfg and function call added for version 6 >> cfg=[]; >> % cfg.parameter = string, describing the functional data >> to be processed, e.g. 'pow', 'coh' or 'nai' >> % cfg.filename = filename without the extension >> % cfg.filetype = 'analyze', 'spm', 'vmp' or 'vmr' >> % cfg.vmpversion = 1 or 2 (default) version of the vmp-format >> to use >> % cfg.coordinates = 'spm, 'ctf' or empty for interactive >> (default = []) >> cfg.parameter='pow'; >> cfg.filename=filename; >> cfg.filetype = 'spm'; >> cfg.spmversion = 'SPM8'; % capitalized after first error >> message from vers 6 >> % cfg.dataformat='nifti'; % added after first error message from >> vers 6 >> % commented out after 2nd error >> message from vers 6 >> %cfg.vmpversion=2; % this is a filetype, like spm, so don't >> need to specify unless cfg.filetyp='vmp' >> cfg.coordinates='spm'; >> ft_volumewrite(cfg,sourcetempIntN); >> >> >> >> >> >> >> On Wed, Feb 23, 2011 at 7:50 AM, jan-mathijs schoffelen > > wrote: >> Dear Jen, >> >> I notice that indeed in the documentation section of >> ft_write_volume there is a FIXME behind nifti. Yet, nifti format >> seems to be supported by ft_write_volume (at least in a recent >> version of fieldtrip). Did you try it at all (and ran into >> problems) or were you held back by the FIXME statement? Could you >> just try it out using a recent fieldtrip function? >> >> Thanks and best wishes >> >> Jan-Mathijs >> >> >> >> On Feb 23, 2011, at 2:21 AM, Jen Whitman wrote: >> >> Hello, >> >> While writing beamformed images to spm2 format in a previous >> version of fieldtrip (now lost due to a computer crash), I was able >> to get nice-looking results; networks of brain regions consistent >> with existing literature. When I try to write images from the same >> dataset and the same analysis to spm8 format, my results (t-images >> computed across subjects) end up being single clusters spanning >> large sections of the brain (e.g. a 'blob' spanning all of one >> hemisphere but not the other). Unfortunately, some aspects of my >> planned data analyses cannot be performed on spm2 images, so I have >> to find a way of writing to successfully to nifti format. >> >> I just noticed that in the comments in the ft_write_volume >> function, which I am calling via ft_volumewrite, it says 'FIXME' >> next to nifti under the list of supported dataformats. Is there by >> any chance a patch out there for writing nifti images? >> >> Thanks! >> >> _______________________________________________ >> fieldtrip mailing list >> fieldtrip at donders.ru.nl >> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip >> >> Dr. J.M. (Jan-Mathijs) Schoffelen >> Donders Institute for Brain, Cognition and Behaviour, >> Centre for Cognitive Neuroimaging, >> Radboud University Nijmegen, The Netherlands >> J.Schoffelen at donders.ru.nl >> Telephone: 0031-24-3614793 >> >> _______________________________________________ >> fieldtrip mailing list >> fieldtrip at donders.ru.nl >> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip >> >> _______________________________________________ >> fieldtrip mailing list >> fieldtrip at donders.ru.nl >> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > > > Dr. J.M. (Jan-Mathijs) Schoffelen > Donders Institute for Brain, Cognition and Behaviour, > Centre for Cognitive Neuroimaging, > Radboud University Nijmegen, The Netherlands > J.Schoffelen at donders.ru.nl > Telephone: 0031-24-3614793 > > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > > Dr. J.M. (Jan-Mathijs) Schoffelen > Donders Institute for Brain, Cognition and Behaviour, > Centre for Cognitive Neuroimaging, > Radboud University Nijmegen, The Netherlands > J.Schoffelen at donders.ru.nl > Telephone: 0031-24-3614793 > > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > > Dr. J.M. (Jan-Mathijs) Schoffelen > Donders Institute for Brain, Cognition and Behaviour, > Centre for Cognitive Neuroimaging, > Radboud University Nijmegen, The Netherlands > J.Schoffelen at donders.ru.nl > Telephone: 0031-24-3614793 > > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > > Dr. J.M. (Jan-Mathijs) Schoffelen > Donders Institute for Brain, Cognition and Behaviour, > Centre for Cognitive Neuroimaging, > Radboud University Nijmegen, The Netherlands > J.Schoffelen at donders.ru.nl > Telephone: 0031-24-3614793 > > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 -------------- next part -------------- An HTML attachment was scrubbed... URL: From Jan.Hirschmann at med.uni-duesseldorf.de Wed Apr 13 14:31:58 2011 From: Jan.Hirschmann at med.uni-duesseldorf.de (Jan.Hirschmann at med.uni-duesseldorf.de) Date: Wed, 13 Apr 2011 14:31:58 +0200 Subject: [FieldTrip] I think you solved the problem In-Reply-To: References: <72E993C35FB11743B79FF9286E5B6D8B02676142@Mail2-UKD.VMED.UKD><7B5CA863-D143-404C-BCB9-805AA6E6E546@donders.ru.nl><72E993C35FB11743B79FF9286E5B6D8B02676264@Mail2-UKD.VMED.UKD> Message-ID: <72E993C35FB11743B79FF9286E5B6D8B026763B8@Mail2-UKD.VMED.UKD> Dear Jan-Mathijs, I think we solved the problem. Everthing is like you said in the first place. ft_volumerealign and ft_volumesegment should be called with cfg.coordsys='neuromag'. The only thing that was wrong is that for the voxel coordinates read from the Neuromag GUI x and y should be swapped. For anyone interested I attach a script that is meant to be easy-to-use for beginners. Thank you very much for your time! ________________________________ Von: fieldtrip-bounces at donders.ru.nl [mailto:fieldtrip-bounces at donders.ru.nl] Im Auftrag von jan-mathijs schoffelen Gesendet: Dienstag, 12. April 2011 21:18 An: Email discussion list for the FieldTrip project Betreff: Re: [FieldTrip] I think you solved the problem Dear Jan, I suspect that your mri, as it comes out of ft_read_mri is already coregistered in neuromag space. After your realignment and after replacing mri.transform with real_mri.transform, the coordinate axes in your pic1 look strange. This I think causes the 'dropped pocket change'. What happens if you skip the ft_volumerealign step and call ft_volumesegment directly on the mri (with cfg.coordsys = 'neuromag', or, for what it's worth, without cfg.coordsys; in this case you will be able to verify the coordinate system)? Alternatively, if this doesn't work, could you replace mri.transform by eye(4) prior to calling ft_volumerealign and ft_volumesegment (both with cfg.coordsys = 'neuromag' and no further tampering with transformation matrices?). Thanks JM On Apr 12, 2011, at 8:49 PM, < Jan.Hirschmann at med.uni-duesseldorf.de> wrote: Dear Jan-Mathijs, sorry, I think I was a bit too enthusiastic when I said everything worked out wonderfully. It worked only once. After an afternoon of confusion I concluded that on my first try I must have misspelled cfg.coordsys='neuromag' on my calls to ft_volumerealign and ft_volumesegment. In fact, the segmentation looks really bad with these settings. What works for me is written underneath: mri = ft_read_mri('....fif'); hdr=ft_read_header('...fif'); mri.anatomy=double(mri.anatomy); %this is taken from the Neuromag GUI for MRI-MEG Integration cfg=[]; cfg.fiducial.rpa=[136.35 142.80 31.96]; cfg.fiducial.nas=[47.84 101.80 100.10]; cfg.fiducial.lpa=[139.22 146.17 162.69]; %go from neuromag voxel to neuromag head coordinates cfg.coordsys='neuromag'; cfg.method='fiducial'; real_mri=ft_volumerealign(cfg,mri); %taking real_mri with its coordsys field will not work, so I take mri mri.transform=real_mri.transform; cfg = []; cfg.keepintermediate = 'no'; cfg.write = 'no'; segmentedmri = ft_volumesegment(cfg, mri); Before segmentation the function shows some kind of brain (pic 1). When segmentation is done the segmented brain looks good (pic 2) but the brain does not fit the helmet (pic 3). It is looking at its feet as if it dropped some pocket change. Do you know what is going on? Thanks, jan ________________________________ Von: fieldtrip-bounces at donders.ru.nl [ mailto:fieldtrip-bounces at donders.ru.nl] Im Auftrag von jan-mathijs schoffelen Gesendet: Dienstag, 12. April 2011 12:11 An: Email discussion list for the FieldTrip project Betreff: Re: [FieldTrip] I think you solved the problem Dear Jan, Apart from not being properly aligned, the segmentation looks a bit strange to me. I suspect that not everything went well here ;o). Could you try the following: specify cfg.coordsys = 'neuromag', both in your call to ft_volumerealign and in your call to ft_volumesegment. The cfg.coordinates for ft_volumesegment has to be removed (actually it is a deprecated option). The idea now is that mri-structures in fieldtrip can have a coordsys field, which allows for more transparent use of the different head coordinate system conventions. This takes away the need for intermediately coregistering the MRI in 'ctf'-convention, and would also take away your need to call headcoordinates later on. Best wishes, Jan-Mathijs On Apr 12, 2011, at 11:07 AM, < Jan.Hirschmann at med.uni-duesseldorf.de> wrote: Dear fieldtrip experts, I have two questions regarding head model creation. As noted on this thread, the volumesegment function was updated and I tested it for our Neuromag data. The segmentation is performed, but unfortunately it is not aligned with the MRI in my case. Here is the code I am using, the fieldtrip is from 9th April 2011. %read mri mri = ft_read_mri(subject_files.fiff_mri); mri.anatomy=double(mri.anatomy); %these are the fiducials for this subject taken from the Neuromag GUI for coregistration cfg=[]; cfg.fiducial.rpa=[136.35 142.80 31.96]; cfg.fiducial.nas=[47.84 101.80 100.10]; cfg.fiducial.lpa=[139.22 146.17 162.69]; %define the head coordinate system according to CTF conventions cfg.method='fiducial'; real_mri=ft_volumerealign(cfg,mri); %segment cfg = []; cfg.template = '/data/apps/spm/spm8/templates/T1.nii'; cfg.coordinates = 'ctf'; cfg.keepintermediate = 'no'; segmentedmri = ft_volumesegment(cfg, real_mri); %plot white matter test=segmentedmri; test.anatomy=real_mri.anatomy; cfg=[]; cfg.funparameter='white'; ft_sourceplot(cfg,test); %see attached picture The other issue regards back-transformation from CTF to Neuromag coordinates, which is necessary to make the head model fit the sensors. My idea was to create an appropriate transformation matrix like this. cd /net/avidya/storage/home/jan/fieldtrip-20110409/private ctfmat=headcoordinates(nas,lpa,rpa,'ctf'); nmmat=headcoordinates(nas,lpa,rpa,'neuromag'); ctf_to_nm=nmmat/ctfmat; And then to use it on the head model to bring it back into Neuromag coordinates: %create single shell, realistic headmodel cfg = []; hdm = ft_prepare_singleshell(cfg,segmentedmri); % transformation of headmodel into Neuromag space hdm.bnd.pnt=warp_apply(ctf_to_nm,hdm.bnd.pnt,'homogeneous'); Does this survive a sanity check? Best regards and thanks a lot, Jan ________________________________ Von: fieldtrip-bounces at donders.ru.nl [ mailto:fieldtrip-bounces at donders.ru.nl] Im Auftrag von Jen Whitman Gesendet: Montag, 28. Februar 2011 22:32 An: Email discussion list for the FieldTrip project Betreff: [FieldTrip] I think you solved the problem I just checked, and when I re-ran my segmentation script with the new Fieldtrip in order to use an spm8 template image, coordinates got reversed. When I take out the calls to flipdim, they look fine (see attached screenshots). That certainly explains the meaningless results I was getting! Thanks for figuring that out, Jen On Mon, Feb 28, 2011 at 12:36 PM, jan-mathijs schoffelen < jan.schoffelen at donders.ru.nl> wrote: Hi Jen, At first glance I have a comment on your script. You may need to explicitly check the alignment of your segmented volume and the original anatomy. A while a go some changes were made to ft_volumesegment, taking away the need to do the flipdim(flipdim... operations. I have posted this on the discussion list last January, but you may not have noticed. Anyway, if you now have used a recent version of FieldTrip for your segmentation both the location of your dipole grid, and the volume conductor model will not be adequately coregistered with the data, which may lead to funky results to begin with. That's most likely not related to the filetype in which the volumes are saved for later use. Best wishes, Jan-Mathijs On Feb 28, 2011, at 8:59 PM, Jen Whitman wrote: Hello Jan, When calling volumesegment, I specified 'ctf' as the coordinate system. The function I wrote to call volumesegment and prepare_singleshell for each subject and save the results is pasted below, with a couple of comments added for clarity. Over the weekend I tried specifying the coordinate system in the call to ft_volumenormalise as 'ctf' rather than 'spm', and commented out all the lines that said cfg.spmversion = 'spm8'; before calling a function. However, that created worse results, as each plot involved stripes of activation and empty voxels, suggesting that 'ctf' was not the correct coordinate system to specify. Thanks for the attached script. Looking in that the comments in that, I suspect that the solution to my problems will be to specify my filetype as nifti_img rather than nifti. I'll let you know how that goes. Jen ------------------------------------------------------------------------ ------------------------------------ % the variable subj is simply a string consisting of a subject number (e.g. 's05') which can be a folder name or part of a filename function [vol mri segmentedmri segmentedmriF]=call_volume_segment_function_spm8(subj) cfg.spmversion = 'spm8'; cfg.template = '/home/woodwardlab/spm8/templates/EPI.nii'; %cfg.template='/home/common/matlab/spm2/templates/T1.mnc'; cfg.name=[subj '_volseg']; cfg.write='yes'; cfg.smooth='no'; cfg.coordinates='ctf'; mri=read_mri([subj '/mri/' subj 'head.mri']); % made with CTF mriConverter and mriViewer software, after fiducials were marked segmentedmri = volumesegment(cfg, mri); segmentedmriF = segmentedmri; segmentedmriF.gray = flipdim(flipdim(flipdim(segmentedmriF.gray,3),2),1); segmentedmriF.white = flipdim(flipdim(flipdim(segmentedmriF.white,3),2),1); segmentedmriF.csf = flipdim(flipdim(flipdim(segmentedmriF.csf,3),2),1); segmentedmriF.transform = mri.transform; segmentedmriF.anatomy = mri.anatomy; cfg = []; cfg.spmversion = 'spm8'; vol = prepare_singleshell(cfg, segmentedmriF); eval(['save ' subj '/meg/mrisegmented.mat mri segmentedmri segmentedmriF vol']) On Sat, Feb 26, 2011 at 5:26 AM, jan-mathijs schoffelen < jan.schoffelen at donders.ru.nl> wrote: Dear Jen, I do not manage to reproduce your issue, when only focussing on the ft_volumewrite and visualization part of your pipeline. See attached script, and yet an updated version of ft_volumewrite which you need to (hopefully) draw the same conclusion as I did. Yet, I only now realize that your question may pertain to the entire pipeline. It could be that something is going wrong there. I only see now that in the part of your script of which you reported that it gave 'good' results, you specify cfg.coordinates = 'ctf' before calling ft_volumenormalise. I assume this is correct, because the coordinate system your source-reconstructed data lives in, is according to the CTF-convention, and not according to the SPM-convention. On the other hand, the template for the spatial normalization lives in the SPM-coordinate system. In order for the spatial normalization to work OK, Fieldtrip tries to convert from one coordinate system to the other (once again, this is appropriate behaviour), before doing the actual normalization. It seems that at least in the script you sent along, in the final (not working version), you specified cfg.coordinates = 'spm' prior to calling ft_volumenormalise. This is probably wrong. Another important point that should be mentioned, is that the coordinate systems in which the functional data and the anatomical data live should be the same for the ft_sourceinterpolate to make sense. In other words, if your source reconstructed images are defined on a 3D grid of positions in CTF-space, the mri.transform of your anatomy should describe a transformation from voxel to CTF-space. I think you may want to revisit step by step this part of the pipeline; I don't think the problem lies in the writing. A final possibility of course is that Mricron is misbehaving... Best, Jan-Mathijs On Feb 25, 2011, at 9:44 PM, Jen Whitman wrote: Hi Jan, I tried re-running the analysis with the new script you sent me, and the latest version of fieldtrip (since I needed ft_get_opt as well), but the spm8 images being written are still producing flawed results. It's the same problem as I mentioned briefly in my previous post. I am not getting any error messages when writing these images. Rather, my problem is that the spm8 and spm2 results from the same data ought to be identical when viewed in mricron, but they're far from it. When I use mricron to look at the results from the spm8-format images, combined across participants to create a t-image, I just get a single 'blob' spanning roughly half the brain. In contrast, when I used spm2-format previously on the same data, the t-image was much more meaningful; a posterior alpha power decrease in a set of regions corresponding to the 'task-positive network' (a network found in the results of an fMRI version of my experiment, and widely reported in the fMRI literature). This failure to replicate the spm2 results when using spm8 images from the same data leads me to suspect that something is wrong with the coordinates for spm8 format. However, after experimenting extensively with different cfg options I still haven't identified the problem. If I my structural MRIs have been saved to .mri files using CTF's MRIConverter program, which cfg options, particularly for coordinates, template images, and filetypes, should I specify before calling the ft_volumesegment, ft_prepare_singleshell, ft_sourceinterpolate, ft_volumenormalise, and ft_volumewrite functions? Or should I be calling a different set of functions now? Thanks again for your help, Jen On Thu, Feb 24, 2011 at 10:07 AM, Jen Whitman wrote: Great, thanks! I'll start the analysis with your new script today and will let you know how it works out. Jen On Thu, Feb 24, 2011 at 4:44 AM, jan-mathijs schoffelen < jan.schoffelen at donders.ru.nl> wrote: Dear Jen, I managed to reproduce your problem. The code was rather buggy and indeed ft_volumewrite did not behave as it should have. I now fixed it in the code and it should run fine now. Please find the updated file attached. It will be available on our ftp-server as of tonight. Please note that I updated the documentation, and changed the names of some of the options a bit. If you want to save your data in analyze-format, you should specify cfg.filetype = 'analyze_spm'. If you specify cfg.filetype = 'nifti', it should write out a volume to nifti-format, using SPM8. Best wishes, Jan-Mathijs On Feb 23, 2011, at 7:44 PM, Jen Whitman wrote: Dear Jan, Thanks for the quick reply. Yes, I have tried it out quite a few times now, experimenting with different settings in the cfgs. Below I'll paste the code I've been using to write images - first the code that successfully created spm2 images that produced good results, then the code used for creating nifti format images from the same data. The comments in this second part are at this point a bit of a maze of cfg options I've been changing back & forth. Any insights/suggestions regarding how to set up my cfgs to make this work would be greatly appreciated. Jen %%%%%%%% this code generated spm2-compatible images which did work (producing results that made sense). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% sourcetemp.avg.pow = (sourcetemp.avg.pow - sourcePre.avg.pow) ./ sourcePre.avg.pow; cfg = []; cfg.downsample = 2; sourcetempInt = sourceinterpolate(cfg, sourcetemp , mri); % projecting the plot onto a surface... cfg = []; cfg.coordinates = 'ctf'; cfg.template = '/home/common/matlab/spm2/templates/T1.mnc'; %this template is in MNI coordinates sourcetempIntN = volumenormalise(cfg, sourcetempInt); filename=[subj 'run' int2str(r) 'cond' int2str(cond) '_' int2str(f) 'HzWin' int2str(win) 'width750ms']; cfg=[]; cfg.parameter = 'avg.pow'; % string, describing the functional data to be processed, e.g. 'pow', 'coh' or 'nai' cfg.filename = [filename '.img']; %'testimageoutput_alphafreq'; % filename without the extension cfg.filetype = 'spm'; %'analyze', 'spm', 'vmp' or 'vmr' cfg.coordinates = 'spm'; %'spm, 'ctf' or empty for interactive (default = []) cfg.datatype = 'double'; %'float'; %'double'; %'bit1', 'uint8', 'int16', 'int32', 'float' or 'double' volumewrite(cfg, sourcetempIntN) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%% this code below hasn't worked yet... % I added cfg.spmversion = 'spm8'; % in the cfgs for the calls to ft_prepare_leadfield and ft_sourceanalysis, % and in the call to prepare_singleshell after calling volumesegment % I've also ensured that spm8 is the only spm version in my path, even in % the fieldtrip/external folder, and ensured that spm8 is installed properly % (files compiled correctly, etc..) sourcetemp.avg.pow = (sourcetemp.avg.pow - sourcePre.avg.pow) ./ sourcePre.avg.pow; filename=[subj 'run' int2str(r) 'cond' int2str(cond) '_' int2str(f) 'Hzspm8_FIXv9_Win' int2str(win) 'width750ms.img']; cfg = []; % cfg.coordinates = 'spm'; % changed for version 5 % cfg.spmversion = 'spm8'; % changed for version 5 cfg.downsample = 4; sourcetempInt = ft_sourceinterpolate(cfg, sourcetemp , mri); % projecting the plot onto a surface... cfg = []; %cfg.coordinates = 'spm'; % changed for version 5 %cfg.coordinates = 'ctf'; % changed for version 5 cfg.coordinates = 'spm'; % changed back to spm for version 9 cfg.downsample = 4; %cfg.spmversion = 'spm8'; % changed for version 6 (because this gets specified in volumewrite) cfg.template = 'Hmatrix/mask.nii.nii'; % basically equivalent to using spm8/templates/EPI.nii, except that mask.nii (produced from fmri data) has the desired voxel size % cfg.name = [filename]; % changed for version 6 %cfg.write= 'yes'; % changed for version 6 (when this was set to 'yes' there was no subsequent call to volumewrite) cfg.write= 'no'; % changed for version 6 sourcetempIntN = ft_volumenormalise(cfg, sourcetempInt); % this whole cfg and function call added for version 6 cfg=[]; % cfg.parameter = string, describing the functional data to be processed, e.g. 'pow', 'coh' or 'nai' % cfg.filename = filename without the extension % cfg.filetype = 'analyze', 'spm', 'vmp' or 'vmr' % cfg.vmpversion = 1 or 2 (default) version of the vmp-format to use % cfg.coordinates = 'spm, 'ctf' or empty for interactive (default = []) cfg.parameter='pow'; cfg.filename=filename; cfg.filetype = 'spm'; cfg.spmversion = 'SPM8'; % capitalized after first error message from vers 6 % cfg.dataformat='nifti'; % added after first error message from vers 6 % commented out after 2nd error message from vers 6 %cfg.vmpversion=2; % this is a filetype, like spm, so don't need to specify unless cfg.filetyp='vmp' cfg.coordinates='spm'; ft_volumewrite(cfg,sourcetempIntN); On Wed, Feb 23, 2011 at 7:50 AM, jan-mathijs schoffelen wrote: Dear Jen, I notice that indeed in the documentation section of ft_write_volume there is a FIXME behind nifti. Yet, nifti format seems to be supported by ft_write_volume (at least in a recent version of fieldtrip). Did you try it at all (and ran into problems) or were you held back by the FIXME statement? Could you just try it out using a recent fieldtrip function? Thanks and best wishes Jan-Mathijs On Feb 23, 2011, at 2:21 AM, Jen Whitman wrote: Hello, While writing beamformed images to spm2 format in a previous version of fieldtrip (now lost due to a computer crash), I was able to get nice-looking results; networks of brain regions consistent with existing literature. When I try to write images from the same dataset and the same analysis to spm8 format, my results (t-images computed across subjects) end up being single clusters spanning large sections of the brain (e.g. a 'blob' spanning all of one hemisphere but not the other). Unfortunately, some aspects of my planned data analyses cannot be performed on spm2 images, so I have to find a way of writing to successfully to nifti format. I just noticed that in the comments in the ft_write_volume function, which I am calling via ft_volumewrite, it says 'FIXME' next to nifti under the list of supported dataformats. Is there by any chance a patch out there for writing nifti images? Thanks! _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: headmodel_with_neuromag.m Type: application/octet-stream Size: 2780 bytes Desc: headmodel_with_neuromag.m URL: From jan.schoffelen at donders.ru.nl Wed Apr 13 16:57:07 2011 From: jan.schoffelen at donders.ru.nl (jan-mathijs schoffelen) Date: Wed, 13 Apr 2011 16:57:07 +0200 Subject: [FieldTrip] I think you solved the problem In-Reply-To: <72E993C35FB11743B79FF9286E5B6D8B026763B8@Mail2-UKD.VMED.UKD> References: <72E993C35FB11743B79FF9286E5B6D8B02676142@Mail2-UKD.VMED.UKD><7B5CA863-D143-404C-BCB9-805AA6E6E546@donders.ru.nl><72E993C35FB11743B79FF9286E5B6D8B02676264@Mail2-UKD.VMED.UKD> <72E993C35FB11743B79FF9286E5B6D8B026763B8@Mail2-UKD.VMED.UKD> Message-ID: <5AC469DB-D5B1-4E3C-AE21-01A53AE94A26@donders.ru.nl> Dear Jan, No problem. Thanks for the script. If you feel up to it, you are kindly invited to update the documentation on the fieldtrip wiki as well. If I recall correctly, at some point Hanneke added some documentation about how to create MNI-based dipole grids for neuromag data. A lot of the intermediate steps have now become obsolete and this part of the wiki can be substantially cleaned. Thanks, Jan-Mathijs On Apr 13, 2011, at 2:31 PM, wrote: > Dear Jan-Mathijs, > > I think we solved the problem. Everthing is like you said in the > first place. ft_volumerealign and ft_volumesegment should be called > with cfg.coordsys=’neuromag’. The only thing that was wrong is that > for the voxel coordinates read from the Neuromag GUI x and y should > be swapped. For anyone interested I attach a script that is meant to > be easy-to-use for beginners. > > Thank you very much for your time! > Von: fieldtrip-bounces at donders.ru.nl [mailto:fieldtrip-bounces at donders.ru.nl > ] Im Auftrag von jan-mathijs schoffelen > Gesendet: Dienstag, 12. April 2011 21:18 > An: Email discussion list for the FieldTrip project > Betreff: Re: [FieldTrip] I think you solved the problem > > Dear Jan, > > I suspect that your mri, as it comes out of ft_read_mri is already > coregistered in neuromag space. After your realignment and after > replacing mri.transform with real_mri.transform, the coordinate axes > in your pic1 look strange. This I think causes the 'dropped pocket > change'. > What happens if you skip the ft_volumerealign step and call > ft_volumesegment directly on the mri (with cfg.coordsys = > 'neuromag', or, for what it's worth, without cfg.coordsys; in this > case you will be able to verify the coordinate system)? > Alternatively, if this doesn't work, could you replace mri.transform > by eye(4) prior to calling ft_volumerealign and ft_volumesegment > (both with cfg.coordsys = 'neuromag' and no further tampering with > transformation matrices?). > > Thanks > > JM > > > On Apr 12, 2011, at 8:49 PM, > wrote: > > > Dear Jan-Mathijs, > > sorry, I think I was a bit too enthusiastic when I said everything > worked out wonderfully. It worked only once. After an afternoon of > confusion I concluded that on my first try I must have misspelled > cfg.coordsys=’neuromag’ on my calls to ft_volumerealign and > ft_volumesegment. In fact, the segmentation looks really bad with > these settings. What works for me is written underneath: > > mri = ft_read_mri('….fif'); > hdr=ft_read_header('…fif'); > mri.anatomy=double(mri.anatomy); > > %this is taken from the Neuromag GUI for MRI-MEG Integration > cfg=[]; > cfg.fiducial.rpa=[136.35 142.80 31.96]; > cfg.fiducial.nas=[47.84 101.80 100.10]; > cfg.fiducial.lpa=[139.22 146.17 162.69]; > > %go from neuromag voxel to neuromag head coordinates > cfg.coordsys='neuromag'; > cfg.method='fiducial'; > real_mri=ft_volumerealign(cfg,mri); > > %taking real_mri with its coordsys field will not work, so I take mri > mri.transform=real_mri.transform; > > cfg = []; > cfg.keepintermediate = 'no'; > cfg.write = 'no'; > segmentedmri = ft_volumesegment(cfg, mri); > > > Before segmentation the function shows some kind of brain (pic 1). > When segmentation is done the segmented brain looks good (pic 2) but > the brain does not fit the helmet (pic 3). It is looking at its feet > as if it dropped some pocket change. Do you know what is going on? > > Thanks, > jan > > Von: fieldtrip-bounces at donders.ru.nl [mailto:fieldtrip-bounces at donders.ru.nl > ] Im Auftrag von jan-mathijs schoffelen > Gesendet: Dienstag, 12. April 2011 12:11 > An: Email discussion list for the FieldTrip project > Betreff: Re: [FieldTrip] I think you solved the problem > > Dear Jan, > > Apart from not being properly aligned, the segmentation looks a bit > strange to me. I suspect that not everything went well here ;o). > Could you try the following: > > specify cfg.coordsys = 'neuromag', both in your call to > ft_volumerealign and in your call to ft_volumesegment. The > cfg.coordinates for ft_volumesegment has to be removed (actually it > is a deprecated option). The idea now is that mri-structures in > fieldtrip can have a coordsys field, which allows for more > transparent use of the different head coordinate system conventions. > This takes away the need for intermediately coregistering the MRI in > 'ctf'-convention, and would also take away your need to call > headcoordinates later on. > > Best wishes, > > Jan-Mathijs > > > On Apr 12, 2011, at 11:07 AM, duesseldorf.de> wrote: > > > > Dear fieldtrip experts, > > I have two questions regarding head model creation. As noted on this > thread, the volumesegment function was updated and I tested it for > our Neuromag data. The segmentation is performed, but unfortunately > it is not aligned with the MRI in my case. Here is the code I am > using, the fieldtrip is from 9th April 2011. > > %read mri > mri = ft_read_mri(subject_files.fiff_mri); > mri.anatomy=double(mri.anatomy); > > %these are the fiducials for this subject taken from the Neuromag > GUI for coregistration > cfg=[]; > cfg.fiducial.rpa=[136.35 142.80 31.96]; > cfg.fiducial.nas=[47.84 101.80 100.10]; > cfg.fiducial.lpa=[139.22 146.17 162.69]; > > %define the head coordinate system according to CTF conventions > cfg.method='fiducial'; > real_mri=ft_volumerealign(cfg,mri); > > %segment > cfg = []; > cfg.template = '/data/apps/spm/spm8/templates/T1.nii'; > cfg.coordinates = 'ctf'; > cfg.keepintermediate = 'no'; > segmentedmri = ft_volumesegment(cfg, real_mri); > > %plot white matter > test=segmentedmri; > test.anatomy=real_mri.anatomy; > cfg=[]; > cfg.funparameter='white'; > ft_sourceplot(cfg,test); %see attached picture > > The other issue regards back-transformation from CTF to Neuromag > coordinates, which is necessary to make the head model fit the > sensors. My idea was to create an appropriate transformation matrix > like this. > > cd /net/avidya/storage/home/jan/fieldtrip-20110409/private > ctfmat=headcoordinates(nas,lpa,rpa,'ctf'); > nmmat=headcoordinates(nas,lpa,rpa,'neuromag'); > ctf_to_nm=nmmat/ctfmat; > > > And then to use it on the head model to bring it back into Neuromag > coordinates: > > %create single shell, realistic headmodel > cfg = []; > hdm = ft_prepare_singleshell(cfg,segmentedmri); > > % transformation of headmodel into Neuromag space > hdm.bnd.pnt=warp_apply(ctf_to_nm,hdm.bnd.pnt,'homogeneous'); > > Does this survive a sanity check? > > Best regards and thanks a lot, > > Jan > > > Von: fieldtrip-bounces at donders.ru.nl [mailto:fieldtrip-bounces at donders.ru.nl > ] Im Auftrag von Jen Whitman > Gesendet: Montag, 28. Februar 2011 22:32 > An: Email discussion list for the FieldTrip project > Betreff: [FieldTrip] I think you solved the problem > > I just checked, and when I re-ran my segmentation script with the > new Fieldtrip in order to use an spm8 template image, coordinates > got reversed. When I take out the calls to flipdim, they look fine > (see attached screenshots). That certainly explains the meaningless > results I was getting! > > Thanks for figuring that out, > > Jen > > On Mon, Feb 28, 2011 at 12:36 PM, jan-mathijs schoffelen > wrote: > Hi Jen, > > At first glance I have a comment on your script. You may need to > explicitly check the alignment of your segmented volume and the > original anatomy. A while a go some changes were made to > ft_volumesegment, taking away the need to do the flipdim(flipdim... > operations. I have posted this on the discussion list last January, > but you may not have noticed. > Anyway, if you now have used a recent version of FieldTrip for your > segmentation both the location of your dipole grid, and the volume > conductor model will not be adequately coregistered with the data, > which may lead to funky results to begin with. That's most likely > not related to the filetype in which the volumes are saved for later > use. > > Best wishes, > > Jan-Mathijs > > > > On Feb 28, 2011, at 8:59 PM, Jen Whitman wrote: > > > > > Hello Jan, > > When calling volumesegment, I specified 'ctf' as the coordinate > system. The function I wrote to call volumesegment and > prepare_singleshell for each subject and save the results is pasted > below, with a couple of comments added for clarity. > Over the weekend I tried specifying the coordinate system in the > call to ft_volumenormalise as 'ctf' rather than 'spm', and commented > out all the lines that said cfg.spmversion = 'spm8'; before calling > a function. However, that created worse results, as each plot > involved stripes of activation and empty voxels, suggesting that > 'ctf' was not the correct coordinate system to specify. > > Thanks for the attached script. Looking in that the comments in > that, I suspect that the solution to my problems will be to specify > my filetype as nifti_img rather than nifti. I'll let you know how > that goes. > > Jen > > ------------------------------------------------------------------------------------------------------------ > % the variable subj is simply a string consisting of a subject > number (e.g. 's05') which can be a folder name or part of a filename > function [vol mri segmentedmri > segmentedmriF]=call_volume_segment_function_spm8(subj) > cfg.spmversion = 'spm8'; > cfg.template = '/home/woodwardlab/spm8/templates/EPI.nii'; > %cfg.template='/home/common/matlab/spm2/templates/T1.mnc'; > cfg.name=[subj '_volseg']; > cfg.write='yes'; > cfg.smooth='no'; > cfg.coordinates='ctf'; > mri=read_mri([subj '/mri/' subj 'head.mri']); % made with CTF > mriConverter and mriViewer software, after fiducials were marked > segmentedmri = volumesegment(cfg, mri); > segmentedmriF = segmentedmri; > segmentedmriF.gray = flipdim(flipdim(flipdim(segmentedmriF.gray,3), > 2),1); > segmentedmriF.white = flipdim(flipdim(flipdim(segmentedmriF.white,3), > 2),1); > segmentedmriF.csf = flipdim(flipdim(flipdim(segmentedmriF.csf,3), > 2),1); > segmentedmriF.transform = mri.transform; > segmentedmriF.anatomy = mri.anatomy; > cfg = []; > cfg.spmversion = 'spm8'; > vol = prepare_singleshell(cfg, segmentedmriF); > eval(['save ' subj '/meg/mrisegmented.mat mri segmentedmri > segmentedmriF vol']) > > > > > > On Sat, Feb 26, 2011 at 5:26 AM, jan-mathijs schoffelen > wrote: > Dear Jen, > > I do not manage to reproduce your issue, when only focussing on the > ft_volumewrite and visualization part of your pipeline. See attached > script, and yet an updated version of ft_volumewrite which you need > to (hopefully) draw the same conclusion as I did. > Yet, I only now realize that your question may pertain to the entire > pipeline. It could be that something is going wrong there. > I only see now that in the part of your script of which you reported > that it gave 'good' results, you specify cfg.coordinates = 'ctf' > before calling ft_volumenormalise. I assume this is correct, because > the coordinate system your source-reconstructed data lives in, is > according to the CTF-convention, and not according to the SPM- > convention. On the other hand, the template for the spatial > normalization lives in the SPM-coordinate system. In order for the > spatial normalization to work OK, Fieldtrip tries to convert from > one coordinate system to the other (once again, this is appropriate > behaviour), before doing the actual normalization. It seems that at > least in the script you sent along, in the final (not working > version), you specified cfg.coordinates = 'spm' prior to calling > ft_volumenormalise. This is probably wrong. > Another important point that should be mentioned, is that the > coordinate systems in which the functional data and the anatomical > data live should be the same for the ft_sourceinterpolate to make > sense. In other words, if your source reconstructed images are > defined on a 3D grid of positions in CTF-space, the mri.transform of > your anatomy should describe a transformation from voxel to CTF-space. > I think you may want to revisit step by step this part of the > pipeline; I don't think the problem lies in the writing. > A final possibility of course is that Mricron is misbehaving... > > Best, > > Jan-Mathijs > > > > > > > On Feb 25, 2011, at 9:44 PM, Jen Whitman wrote: > > > > > Hi Jan, > > I tried re-running the analysis with the new script you sent me, and > the latest version of fieldtrip (since I needed ft_get_opt as well), > but the spm8 images being written are still producing flawed > results. It's the same problem as I mentioned briefly in my previous > post. I am not getting any error messages when writing these images. > Rather, my problem is that the spm8 and spm2 results from the same > data ought to be identical when viewed in mricron, but they're far > from it. When I use mricron to look at the results from the spm8- > format images, combined across participants to create a t-image, I > just get a single 'blob' spanning roughly half the brain. In > contrast, when I used spm2-format previously on the same data, the t- > image was much more meaningful; a posterior alpha power decrease in > a set of regions corresponding to the 'task-positive network' (a > network found in the results of an fMRI version of my experiment, > and widely reported in the fMRI literature). > > This failure to replicate the spm2 results when using spm8 images > from the same data leads me to suspect that something is wrong with > the coordinates for spm8 format. However, after experimenting > extensively with different cfg options I still haven't identified > the problem. If I my structural MRIs have been saved to .mri files > using CTF's MRIConverter program, which cfg options, particularly > for coordinates, template images, and filetypes, should I specify > before calling the ft_volumesegment, ft_prepare_singleshell, > ft_sourceinterpolate, ft_volumenormalise, and ft_volumewrite > functions? Or should I be calling a different set of functions now? > > Thanks again for your help, > > Jen > > On Thu, Feb 24, 2011 at 10:07 AM, Jen Whitman > wrote: > Great, thanks! > > I'll start the analysis with your new script today and will let you > know how it works out. > > Jen > > On Thu, Feb 24, 2011 at 4:44 AM, jan-mathijs schoffelen > wrote: > Dear Jen, > > I managed to reproduce your problem. The code was rather buggy and > indeed ft_volumewrite did not behave as it should have. I now fixed > it in the code and it should run fine now. Please find the updated > file attached. It will be available on our ftp-server as of tonight. > Please note that I updated the documentation, and changed the names > of some of the options a bit. If you want to save your data in > analyze-format, you should specify cfg.filetype = 'analyze_spm'. If > you specify cfg.filetype = 'nifti', it should write out a volume to > nifti-format, using SPM8. > > Best wishes, > > Jan-Mathijs > > > > > > On Feb 23, 2011, at 7:44 PM, Jen Whitman wrote: > >> >> Dear Jan, >> >> Thanks for the quick reply. Yes, I have tried it out quite a few >> times now, experimenting with different settings in the cfgs. Below >> I'll paste the code I've been using to write images - first the >> code that successfully created spm2 images that produced good >> results, then the code used for creating nifti format images from >> the same data. The comments in this second part are at this point a >> bit of a maze of cfg options I've been changing back & forth. Any >> insights/suggestions regarding how to set up my cfgs to make this >> work would be greatly appreciated. >> >> Jen >> >> >> %%%%%%%% this code generated spm2-compatible images which did work >> (producing results that made sense). >> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% >> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% >> >> sourcetemp.avg.pow = (sourcetemp.avg.pow - >> sourcePre.avg.pow) ./ sourcePre.avg.pow; >> >> cfg = []; >> cfg.downsample = 2; >> sourcetempInt = sourceinterpolate(cfg, sourcetemp , mri); >> >> % projecting the plot onto a surface... >> cfg = []; >> cfg.coordinates = 'ctf'; >> cfg.template = '/home/common/matlab/spm2/templates/T1.mnc'; >> %this template is in MNI coordinates >> sourcetempIntN = volumenormalise(cfg, sourcetempInt); >> >> filename=[subj 'run' int2str(r) 'cond' int2str(cond) '_' >> int2str(f) 'HzWin' int2str(win) 'width750ms']; >> cfg=[]; >> cfg.parameter = 'avg.pow'; % string, describing the >> functional data to be processed, e.g. 'pow', 'coh' or 'nai' >> cfg.filename = [filename '.img']; >> %'testimageoutput_alphafreq'; % filename without the extension >> cfg.filetype = 'spm'; %'analyze', 'spm', 'vmp' or 'vmr' >> cfg.coordinates = 'spm'; %'spm, 'ctf' or empty for >> interactive (default = []) >> cfg.datatype = 'double'; %'float'; %'double'; %'bit1', 'uint8', >> 'int16', 'int32', 'float' or 'double' >> >> volumewrite(cfg, sourcetempIntN) >> >> >> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% >> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% >> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% >> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% >> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% >> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% >> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% >> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% >> %%%%% this code below hasn't worked yet... >> >> % I added cfg.spmversion = 'spm8'; >> % in the cfgs for the calls to ft_prepare_leadfield and >> ft_sourceanalysis, >> % and in the call to prepare_singleshell after calling volumesegment >> >> % I've also ensured that spm8 is the only spm version in my path, >> even in >> % the fieldtrip/external folder, and ensured that spm8 is installed >> properly >> % (files compiled correctly, etc..) >> >> sourcetemp.avg.pow = (sourcetemp.avg.pow - >> sourcePre.avg.pow) ./ sourcePre.avg.pow; >> >> filename=[subj 'run' int2str(r) 'cond' int2str(cond) '_' >> int2str(f) 'Hzspm8_FIXv9_Win' int2str(win) 'width750ms.img']; >> >> cfg = []; >> % cfg.coordinates = 'spm'; % changed for version 5 >> % cfg.spmversion = 'spm8'; % changed for version 5 >> cfg.downsample = 4; >> sourcetempInt = ft_sourceinterpolate(cfg, sourcetemp , mri); >> >> >> % projecting the plot onto a surface... >> cfg = []; >> %cfg.coordinates = 'spm'; % changed for version 5 >> %cfg.coordinates = 'ctf'; % changed for version 5 >> cfg.coordinates = 'spm'; % changed back to spm for version 9 >> cfg.downsample = 4; >> %cfg.spmversion = 'spm8'; % changed for version 6 (because this >> gets specified in volumewrite) >> cfg.template = 'Hmatrix/mask.nii.nii'; % basically equivalent >> to using spm8/templates/EPI.nii, except that mask.nii (produced >> from fmri data) has the desired voxel size >> % cfg.name = [filename]; % changed for version 6 >> %cfg.write= 'yes'; % changed for version 6 (when this was set >> to 'yes' there was no subsequent call to volumewrite) >> cfg.write= 'no'; % changed for version 6 >> sourcetempIntN = ft_volumenormalise(cfg, sourcetempInt); >> >> % this whole cfg and function call added for version 6 >> cfg=[]; >> % cfg.parameter = string, describing the functional data >> to be processed, e.g. 'pow', 'coh' or 'nai' >> % cfg.filename = filename without the extension >> % cfg.filetype = 'analyze', 'spm', 'vmp' or 'vmr' >> % cfg.vmpversion = 1 or 2 (default) version of the vmp-format >> to use >> % cfg.coordinates = 'spm, 'ctf' or empty for interactive >> (default = []) >> cfg.parameter='pow'; >> cfg.filename=filename; >> cfg.filetype = 'spm'; >> cfg.spmversion = 'SPM8'; % capitalized after first error >> message from vers 6 >> % cfg.dataformat='nifti'; % added after first error message from >> vers 6 >> % commented out after 2nd error >> message from vers 6 >> %cfg.vmpversion=2; % this is a filetype, like spm, so don't >> need to specify unless cfg.filetyp='vmp' >> cfg.coordinates='spm'; >> ft_volumewrite(cfg,sourcetempIntN); >> >> >> >> >> >> >> >> On Wed, Feb 23, 2011 at 7:50 AM, jan-mathijs schoffelen > > wrote: >> Dear Jen, >> >> I notice that indeed in the documentation section of >> ft_write_volume there is a FIXME behind nifti. Yet, nifti format >> seems to be supported by ft_write_volume (at least in a recent >> version of fieldtrip). Did you try it at all (and ran into >> problems) or were you held back by the FIXME statement? Could you >> just try it out using a recent fieldtrip function? >> >> Thanks and best wishes >> >> Jan-Mathijs >> >> >> >> On Feb 23, 2011, at 2:21 AM, Jen Whitman wrote: >> >> Hello, >> >> While writing beamformed images to spm2 format in a previous >> version of fieldtrip (now lost due to a computer crash), I was able >> to get nice-looking results; networks of brain regions consistent >> with existing literature. When I try to write images from the same >> dataset and the same analysis to spm8 format, my results (t-images >> computed across subjects) end up being single clusters spanning >> large sections of the brain (e.g. a 'blob' spanning all of one >> hemisphere but not the other). Unfortunately, some aspects of my >> planned data analyses cannot be performed on spm2 images, so I have >> to find a way of writing to successfully to nifti format. >> >> I just noticed that in the comments in the ft_write_volume >> function, which I am calling via ft_volumewrite, it says 'FIXME' >> next to nifti under the list of supported dataformats. Is there by >> any chance a patch out there for writing nifti images? >> >> Thanks! >> >> _______________________________________________ >> fieldtrip mailing list >> fieldtrip at donders.ru.nl >> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip >> >> Dr. J.M. (Jan-Mathijs) Schoffelen >> Donders Institute for Brain, Cognition and Behaviour, >> Centre for Cognitive Neuroimaging, >> Radboud University Nijmegen, The Netherlands >> J.Schoffelen at donders.ru.nl >> Telephone: 0031-24-3614793 >> >> _______________________________________________ >> fieldtrip mailing list >> fieldtrip at donders.ru.nl >> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip >> >> _______________________________________________ >> fieldtrip mailing list >> fieldtrip at donders.ru.nl >> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > > > Dr. J.M. (Jan-Mathijs) Schoffelen > Donders Institute for Brain, Cognition and Behaviour, > Centre for Cognitive Neuroimaging, > Radboud University Nijmegen, The Netherlands > J.Schoffelen at donders.ru.nl > Telephone: 0031-24-3614793 > > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > > Dr. J.M. (Jan-Mathijs) Schoffelen > Donders Institute for Brain, Cognition and Behaviour, > Centre for Cognitive Neuroimaging, > Radboud University Nijmegen, The Netherlands > J.Schoffelen at donders.ru.nl > Telephone: 0031-24-3614793 > > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > > Dr. J.M. (Jan-Mathijs) Schoffelen > Donders Institute for Brain, Cognition and Behaviour, > Centre for Cognitive Neuroimaging, > Radboud University Nijmegen, The Netherlands > J.Schoffelen at donders.ru.nl > Telephone: 0031-24-3614793 > > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > > Dr. J.M. (Jan-Mathijs) Schoffelen > Donders Institute for Brain, Cognition and Behaviour, > Centre for Cognitive Neuroimaging, > Radboud University Nijmegen, The Netherlands > J.Schoffelen at donders.ru.nl > Telephone: 0031-24-3614793 > > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > > Dr. J.M. (Jan-Mathijs) Schoffelen > Donders Institute for Brain, Cognition and Behaviour, > Centre for Cognitive Neuroimaging, > Radboud University Nijmegen, The Netherlands > J.Schoffelen at donders.ru.nl > Telephone: 0031-24-3614793 > > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 -------------- next part -------------- An HTML attachment was scrubbed... URL: From inieuwenhuis at berkeley.edu Wed Apr 13 20:51:46 2011 From: inieuwenhuis at berkeley.edu (Ingrid Nieuwenhuis) Date: Wed, 13 Apr 2011 11:51:46 -0700 Subject: [FieldTrip] invalid MEX file error in clusterstat Message-ID: <4DA5F0C2.7090405@berkeley.edu> Hi I'm running ft_sourcestatistics with the following cfg: %%% cluster statistics cfg = []; cfg.parameter = 'stat'; cfg.method = 'montecarlo'; cfg.statistic = 'depsamplesT'; cfg.clusteralpha = 0.05; cfg.numrandomization = 1000; cfg.correctm = 'cluster'; cfg.design(1,1:2*Nsub) = [ones(1,Nsub) 2*ones(1,Nsub)]; cfg.design(2,1:2*Nsub) = [1:Nsub 1:Nsub]; cfg.ivar = 1; cfg.uvar = 2; cfg.alpha = 0.025; %one sided alpha!! stat_clus = ft_sourcestatistics(cfg, Rem{1:Nsub}, Rec{1:Nsub}); and get the below error, am I doing anything wrong (I must admit, I'm running a 2 year old script (which has already generated new data out of 2 year old source data without any errors: very impressive backward compatibility!), or is there just a MEX file missing? Thanks, Ingrid ??? Invalid MEX-file '/home/common/matlab/fieldtrip/external/spm8/spm_bwlabel.mexa64': /home/common/matlab/fieldtrip/external/spm8/spm_bwlabel.mexa64: undefined symbol: mxCreateNumericArray_700. Error in ==> fieldtrip/private/clusterstat at 189 [posclusobs, posnum] = spm_bwlabel(tmp, 6); % use spm_bwlabel for source data to avoid usage of image toolbox Error in ==> statistics_montecarlo at 322 [stat, cfg] = clusterstat(cfg, statrand, statobs,'issource',issource); Error in ==> fieldtrip/private/statistics_wrapper at 285 [stat, cfg] = statmethod(cfg, dat, cfg.design, 'issource',issource); Error in ==> ft_sourcestatistics at 114 [stat, cfg] = statistics_wrapper(cfg, varargin{:}); -- Ingrid Nieuwenhuis PhD Sleep and Neuroimaging Laboratory Department of Psychology University of California, Berkeley California 94720-1650 From mcoskun at mail.uh.edu Thu Apr 14 08:51:46 2011 From: mcoskun at mail.uh.edu (Mehmet-Akif Coskun) Date: Thu, 14 Apr 2011 01:51:46 -0500 Subject: [FieldTrip] dipole time course vs. virtual sensor using SVD Message-ID: <715094a06745c.4da65332@mail.uh.edu> Dear Fieldtrippers, I have been running a simple analysis for two different subject groups on the dipole time course and a virtual sensor using Singular Value Decomposition. The analysis for the two signals yielded different results. I would like to get comments on this issue. The computation of the two signals are as below: dataset: I have 248 channels x 122 time points data (averaged over a number of trials).  1) Virtual sensor using SVD: I isolated the data from 30-100ms (isolated_data: 248 x 22 timepoints) and apply SVD as [U,S,V]=svd(isolated_data). The first column of U (248x1) accounts for the largest proportion of variance and is a vector of weights assigned to the signal recorded from each of the 248 sensors. So i computed the virtual sensors as virt_sens=U(:,1)'*dataset which is a 1x122 signal. 2)Dipole time course: I fitted 1 dipole (ft_dipolefitting) to the data between 30 and 100ms, computed leadfields (ft_compute_leadfield) for the dipole and projected the pinv'ed leadfields on to the dataset to obtain the dipole time course. What may cause the differences in the results for the two approaches? What kind of mathematical assumptions does SVD and dipole fitting does? what are the weakness or the strengths of the two approaches and which one has to be trusted more? I will really appreciate any comments and suggestions. Best regards, Mehmet Coskun -------------- next part -------------- An HTML attachment was scrubbed... URL: From Jan.Hirschmann at med.uni-duesseldorf.de Thu Apr 14 09:31:51 2011 From: Jan.Hirschmann at med.uni-duesseldorf.de (Jan.Hirschmann at med.uni-duesseldorf.de) Date: Thu, 14 Apr 2011 09:31:51 +0200 Subject: [FieldTrip] I think you solved the problem In-Reply-To: <5AC469DB-D5B1-4E3C-AE21-01A53AE94A26@donders.ru.nl> References: <72E993C35FB11743B79FF9286E5B6D8B02676142@Mail2-UKD.VMED.UKD><7B5CA863-D143-404C-BCB9-805AA6E6E546@donders.ru.nl><72E993C35FB11743B79FF9286E5B6D8B02676264@Mail2-UKD.VMED.UKD><72E993C35FB11743B79FF9286E5B6D8B026763B8@Mail2-UKD.VMED.UKD> <5AC469DB-D5B1-4E3C-AE21-01A53AE94A26@donders.ru.nl> Message-ID: <72E993C35FB11743B79FF9286E5B6D8B02676493@Mail2-UKD.VMED.UKD> Dear Jan-Mathijs, sure, I will do that. I have tested one head model with ft_dipole_simulation and beamforming and it looks good (at least when I simulate two conditions and subtract sources the right location comes out). So I guess we (and maybe others) will use the new procedure now. Best, jan ________________________________ Von: fieldtrip-bounces at donders.ru.nl [mailto:fieldtrip-bounces at donders.ru.nl] Im Auftrag von jan-mathijs schoffelen Gesendet: Mittwoch, 13. April 2011 16:57 An: Email discussion list for the FieldTrip project Betreff: Re: [FieldTrip] I think you solved the problem Dear Jan, No problem. Thanks for the script. If you feel up to it, you are kindly invited to update the documentation on the fieldtrip wiki as well. If I recall correctly, at some point Hanneke added some documentation about how to create MNI-based dipole grids for neuromag data. A lot of the intermediate steps have now become obsolete and this part of the wiki can be substantially cleaned. Thanks, Jan-Mathijs On Apr 13, 2011, at 2:31 PM, wrote: Dear Jan-Mathijs, I think we solved the problem. Everthing is like you said in the first place. ft_volumerealign and ft_volumesegment should be called with cfg.coordsys='neuromag'. The only thing that was wrong is that for the voxel coordinates read from the Neuromag GUI x and y should be swapped. For anyone interested I attach a script that is meant to be easy-to-use for beginners. Thank you very much for your time! ________________________________ Von: fieldtrip-bounces at donders.ru.nl [mailto:fieldtrip-bounces at donders.ru.nl] Im Auftrag von jan-mathijs schoffelen Gesendet: Dienstag, 12. April 2011 21:18 An: Email discussion list for the FieldTrip project Betreff: Re: [FieldTrip] I think you solved the problem Dear Jan, I suspect that your mri, as it comes out of ft_read_mri is already coregistered in neuromag space. After your realignment and after replacing mri.transform with real_mri.transform, the coordinate axes in your pic1 look strange. This I think causes the 'dropped pocket change'. What happens if you skip the ft_volumerealign step and call ft_volumesegment directly on the mri (with cfg.coordsys = 'neuromag', or, for what it's worth, without cfg.coordsys; in this case you will be able to verify the coordinate system)? Alternatively, if this doesn't work, could you replace mri.transform by eye(4) prior to calling ft_volumerealign and ft_volumesegment (both with cfg.coordsys = 'neuromag' and no further tampering with transformation matrices?). Thanks JM On Apr 12, 2011, at 8:49 PM, wrote: Dear Jan-Mathijs, sorry, I think I was a bit too enthusiastic when I said everything worked out wonderfully. It worked only once. After an afternoon of confusion I concluded that on my first try I must have misspelled cfg.coordsys='neuromag' on my calls to ft_volumerealign and ft_volumesegment. In fact, the segmentation looks really bad with these settings. What works for me is written underneath: mri = ft_read_mri('....fif'); hdr=ft_read_header('...fif'); mri.anatomy=double(mri.anatomy); %this is taken from the Neuromag GUI for MRI-MEG Integration cfg=[]; cfg.fiducial.rpa=[136.35 142.80 31.96]; cfg.fiducial.nas=[47.84 101.80 100.10]; cfg.fiducial.lpa=[139.22 146.17 162.69]; %go from neuromag voxel to neuromag head coordinates cfg.coordsys='neuromag'; cfg.method='fiducial'; real_mri=ft_volumerealign(cfg,mri); %taking real_mri with its coordsys field will not work, so I take mri mri.transform=real_mri.transform; cfg = []; cfg.keepintermediate = 'no'; cfg.write = 'no'; segmentedmri = ft_volumesegment(cfg, mri); Before segmentation the function shows some kind of brain (pic 1). When segmentation is done the segmented brain looks good (pic 2) but the brain does not fit the helmet (pic 3). It is looking at its feet as if it dropped some pocket change. Do you know what is going on? Thanks, jan ________________________________ Von: fieldtrip-bounces at donders.ru.nl [mailto:fieldtrip-bounces at donders.ru.nl] Im Auftrag von jan-mathijs schoffelen Gesendet: Dienstag, 12. April 2011 12:11 An: Email discussion list for the FieldTrip project Betreff: Re: [FieldTrip] I think you solved the problem Dear Jan, Apart from not being properly aligned, the segmentation looks a bit strange to me. I suspect that not everything went well here ;o). Could you try the following: specify cfg.coordsys = 'neuromag', both in your call to ft_volumerealign and in your call to ft_volumesegment. The cfg.coordinates for ft_volumesegment has to be removed (actually it is a deprecated option). The idea now is that mri-structures in fieldtrip can have a coordsys field, which allows for more transparent use of the different head coordinate system conventions. This takes away the need for intermediately coregistering the MRI in 'ctf'-convention, and would also take away your need to call headcoordinates later on. Best wishes, Jan-Mathijs On Apr 12, 2011, at 11:07 AM, wrote: Dear fieldtrip experts, I have two questions regarding head model creation. As noted on this thread, the volumesegment function was updated and I tested it for our Neuromag data. The segmentation is performed, but unfortunately it is not aligned with the MRI in my case. Here is the code I am using, the fieldtrip is from 9th April 2011. %read mri mri = ft_read_mri(subject_files.fiff_mri); mri.anatomy=double(mri.anatomy); %these are the fiducials for this subject taken from the Neuromag GUI for coregistration cfg=[]; cfg.fiducial.rpa=[136.35 142.80 31.96]; cfg.fiducial.nas=[47.84 101.80 100.10]; cfg.fiducial.lpa=[139.22 146.17 162.69]; %define the head coordinate system according to CTF conventions cfg.method='fiducial'; real_mri=ft_volumerealign(cfg,mri); %segment cfg = []; cfg.template = '/data/apps/spm/spm8/templates/T1.nii'; cfg.coordinates = 'ctf'; cfg.keepintermediate = 'no'; segmentedmri = ft_volumesegment(cfg, real_mri); %plot white matter test=segmentedmri; test.anatomy=real_mri.anatomy; cfg=[]; cfg.funparameter='white'; ft_sourceplot(cfg,test); %see attached picture The other issue regards back-transformation from CTF to Neuromag coordinates, which is necessary to make the head model fit the sensors. My idea was to create an appropriate transformation matrix like this. cd /net/avidya/storage/home/jan/fieldtrip-20110409/private ctfmat=headcoordinates(nas,lpa,rpa,'ctf'); nmmat=headcoordinates(nas,lpa,rpa,'neuromag'); ctf_to_nm=nmmat/ctfmat; And then to use it on the head model to bring it back into Neuromag coordinates: %create single shell, realistic headmodel cfg = []; hdm = ft_prepare_singleshell(cfg,segmentedmri); % transformation of headmodel into Neuromag space hdm.bnd.pnt=warp_apply(ctf_to_nm,hdm.bnd.pnt,'homogeneous'); Does this survive a sanity check? Best regards and thanks a lot, Jan ________________________________ Von: fieldtrip-bounces at donders.ru.nl [mailto:fieldtrip-bounces at donders.ru.nl] Im Auftrag von Jen Whitman Gesendet: Montag, 28. Februar 2011 22:32 An: Email discussion list for the FieldTrip project Betreff: [FieldTrip] I think you solved the problem I just checked, and when I re-ran my segmentation script with the new Fieldtrip in order to use an spm8 template image, coordinates got reversed. When I take out the calls to flipdim, they look fine (see attached screenshots). That certainly explains the meaningless results I was getting! Thanks for figuring that out, Jen On Mon, Feb 28, 2011 at 12:36 PM, jan-mathijs schoffelen wrote: Hi Jen, At first glance I have a comment on your script. You may need to explicitly check the alignment of your segmented volume and the original anatomy. A while a go some changes were made to ft_volumesegment, taking away the need to do the flipdim(flipdim... operations. I have posted this on the discussion list last January, but you may not have noticed. Anyway, if you now have used a recent version of FieldTrip for your segmentation both the location of your dipole grid, and the volume conductor model will not be adequately coregistered with the data, which may lead to funky results to begin with. That's most likely not related to the filetype in which the volumes are saved for later use. Best wishes, Jan-Mathijs On Feb 28, 2011, at 8:59 PM, Jen Whitman wrote: Hello Jan, When calling volumesegment, I specified 'ctf' as the coordinate system. The function I wrote to call volumesegment and prepare_singleshell for each subject and save the results is pasted below, with a couple of comments added for clarity. Over the weekend I tried specifying the coordinate system in the call to ft_volumenormalise as 'ctf' rather than 'spm', and commented out all the lines that said cfg.spmversion = 'spm8'; before calling a function. However, that created worse results, as each plot involved stripes of activation and empty voxels, suggesting that 'ctf' was not the correct coordinate system to specify. Thanks for the attached script. Looking in that the comments in that, I suspect that the solution to my problems will be to specify my filetype as nifti_img rather than nifti. I'll let you know how that goes. Jen ------------------------------------------------------------------------ ------------------------------------ % the variable subj is simply a string consisting of a subject number (e.g. 's05') which can be a folder name or part of a filename function [vol mri segmentedmri segmentedmriF]=call_volume_segment_function_spm8(subj) cfg.spmversion = 'spm8'; cfg.template = '/home/woodwardlab/spm8/templates/EPI.nii'; %cfg.template='/home/common/matlab/spm2/templates/T1.mnc'; cfg.name=[subj '_volseg']; cfg.write='yes'; cfg.smooth='no'; cfg.coordinates='ctf'; mri=read_mri([subj '/mri/' subj 'head.mri']); % made with CTF mriConverter and mriViewer software, after fiducials were marked segmentedmri = volumesegment(cfg, mri); segmentedmriF = segmentedmri; segmentedmriF.gray = flipdim(flipdim(flipdim(segmentedmriF.gray,3),2),1); segmentedmriF.white = flipdim(flipdim(flipdim(segmentedmriF.white,3),2),1); segmentedmriF.csf = flipdim(flipdim(flipdim(segmentedmriF.csf,3),2),1); segmentedmriF.transform = mri.transform; segmentedmriF.anatomy = mri.anatomy; cfg = []; cfg.spmversion = 'spm8'; vol = prepare_singleshell(cfg, segmentedmriF); eval(['save ' subj '/meg/mrisegmented.mat mri segmentedmri segmentedmriF vol']) On Sat, Feb 26, 2011 at 5:26 AM, jan-mathijs schoffelen wrote: Dear Jen, I do not manage to reproduce your issue, when only focussing on the ft_volumewrite and visualization part of your pipeline. See attached script, and yet an updated version of ft_volumewrite which you need to (hopefully) draw the same conclusion as I did. Yet, I only now realize that your question may pertain to the entire pipeline. It could be that something is going wrong there. I only see now that in the part of your script of which you reported that it gave 'good' results, you specify cfg.coordinates = 'ctf' before calling ft_volumenormalise. I assume this is correct, because the coordinate system your source-reconstructed data lives in, is according to the CTF-convention, and not according to the SPM-convention. On the other hand, the template for the spatial normalization lives in the SPM-coordinate system. In order for the spatial normalization to work OK, Fieldtrip tries to convert from one coordinate system to the other (once again, this is appropriate behaviour), before doing the actual normalization. It seems that at least in the script you sent along, in the final (not working version), you specified cfg.coordinates = 'spm' prior to calling ft_volumenormalise. This is probably wrong. Another important point that should be mentioned, is that the coordinate systems in which the functional data and the anatomical data live should be the same for the ft_sourceinterpolate to make sense. In other words, if your source reconstructed images are defined on a 3D grid of positions in CTF-space, the mri.transform of your anatomy should describe a transformation from voxel to CTF-space. I think you may want to revisit step by step this part of the pipeline; I don't think the problem lies in the writing. A final possibility of course is that Mricron is misbehaving... Best, Jan-Mathijs On Feb 25, 2011, at 9:44 PM, Jen Whitman wrote: Hi Jan, I tried re-running the analysis with the new script you sent me, and the latest version of fieldtrip (since I needed ft_get_opt as well), but the spm8 images being written are still producing flawed results. It's the same problem as I mentioned briefly in my previous post. I am not getting any error messages when writing these images. Rather, my problem is that the spm8 and spm2 results from the same data ought to be identical when viewed in mricron, but they're far from it. When I use mricron to look at the results from the spm8-format images, combined across participants to create a t-image, I just get a single 'blob' spanning roughly half the brain. In contrast, when I used spm2-format previously on the same data, the t-image was much more meaningful; a posterior alpha power decrease in a set of regions corresponding to the 'task-positive network' (a network found in the results of an fMRI version of my experiment, and widely reported in the fMRI literature). This failure to replicate the spm2 results when using spm8 images from the same data leads me to suspect that something is wrong with the coordinates for spm8 format. However, after experimenting extensively with different cfg options I still haven't identified the problem. If I my structural MRIs have been saved to .mri files using CTF's MRIConverter program, which cfg options, particularly for coordinates, template images, and filetypes, should I specify before calling the ft_volumesegment, ft_prepare_singleshell, ft_sourceinterpolate, ft_volumenormalise, and ft_volumewrite functions? Or should I be calling a different set of functions now? Thanks again for your help, Jen On Thu, Feb 24, 2011 at 10:07 AM, Jen Whitman wrote: Great, thanks! I'll start the analysis with your new script today and will let you know how it works out. Jen On Thu, Feb 24, 2011 at 4:44 AM, jan-mathijs schoffelen wrote: Dear Jen, I managed to reproduce your problem. The code was rather buggy and indeed ft_volumewrite did not behave as it should have. I now fixed it in the code and it should run fine now. Please find the updated file attached. It will be available on our ftp-server as of tonight. Please note that I updated the documentation, and changed the names of some of the options a bit. If you want to save your data in analyze-format, you should specify cfg.filetype = 'analyze_spm'. If you specify cfg.filetype = 'nifti', it should write out a volume to nifti-format, using SPM8. Best wishes, Jan-Mathijs On Feb 23, 2011, at 7:44 PM, Jen Whitman wrote: Dear Jan, Thanks for the quick reply. Yes, I have tried it out quite a few times now, experimenting with different settings in the cfgs. Below I'll paste the code I've been using to write images - first the code that successfully created spm2 images that produced good results, then the code used for creating nifti format images from the same data. The comments in this second part are at this point a bit of a maze of cfg options I've been changing back & forth. Any insights/suggestions regarding how to set up my cfgs to make this work would be greatly appreciated. Jen %%%%%%%% this code generated spm2-compatible images which did work (producing results that made sense). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% sourcetemp.avg.pow = (sourcetemp.avg.pow - sourcePre.avg.pow) ./ sourcePre.avg.pow; cfg = []; cfg.downsample = 2; sourcetempInt = sourceinterpolate(cfg, sourcetemp , mri); % projecting the plot onto a surface... cfg = []; cfg.coordinates = 'ctf'; cfg.template = '/home/common/matlab/spm2/templates/T1.mnc'; %this template is in MNI coordinates sourcetempIntN = volumenormalise(cfg, sourcetempInt); filename=[subj 'run' int2str(r) 'cond' int2str(cond) '_' int2str(f) 'HzWin' int2str(win) 'width750ms']; cfg=[]; cfg.parameter = 'avg.pow'; % string, describing the functional data to be processed, e.g. 'pow', 'coh' or 'nai' cfg.filename = [filename '.img']; %'testimageoutput_alphafreq'; % filename without the extension cfg.filetype = 'spm'; %'analyze', 'spm', 'vmp' or 'vmr' cfg.coordinates = 'spm'; %'spm, 'ctf' or empty for interactive (default = []) cfg.datatype = 'double'; %'float'; %'double'; %'bit1', 'uint8', 'int16', 'int32', 'float' or 'double' volumewrite(cfg, sourcetempIntN) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%% this code below hasn't worked yet... % I added cfg.spmversion = 'spm8'; % in the cfgs for the calls to ft_prepare_leadfield and ft_sourceanalysis, % and in the call to prepare_singleshell after calling volumesegment % I've also ensured that spm8 is the only spm version in my path, even in % the fieldtrip/external folder, and ensured that spm8 is installed properly % (files compiled correctly, etc..) sourcetemp.avg.pow = (sourcetemp.avg.pow - sourcePre.avg.pow) ./ sourcePre.avg.pow; filename=[subj 'run' int2str(r) 'cond' int2str(cond) '_' int2str(f) 'Hzspm8_FIXv9_Win' int2str(win) 'width750ms.img']; cfg = []; % cfg.coordinates = 'spm'; % changed for version 5 % cfg.spmversion = 'spm8'; % changed for version 5 cfg.downsample = 4; sourcetempInt = ft_sourceinterpolate(cfg, sourcetemp , mri); % projecting the plot onto a surface... cfg = []; %cfg.coordinates = 'spm'; % changed for version 5 %cfg.coordinates = 'ctf'; % changed for version 5 cfg.coordinates = 'spm'; % changed back to spm for version 9 cfg.downsample = 4; %cfg.spmversion = 'spm8'; % changed for version 6 (because this gets specified in volumewrite) cfg.template = 'Hmatrix/mask.nii.nii'; % basically equivalent to using spm8/templates/EPI.nii, except that mask.nii (produced from fmri data) has the desired voxel size % cfg.name = [filename]; % changed for version 6 %cfg.write= 'yes'; % changed for version 6 (when this was set to 'yes' there was no subsequent call to volumewrite) cfg.write= 'no'; % changed for version 6 sourcetempIntN = ft_volumenormalise(cfg, sourcetempInt); % this whole cfg and function call added for version 6 cfg=[]; % cfg.parameter = string, describing the functional data to be processed, e.g. 'pow', 'coh' or 'nai' % cfg.filename = filename without the extension % cfg.filetype = 'analyze', 'spm', 'vmp' or 'vmr' % cfg.vmpversion = 1 or 2 (default) version of the vmp-format to use % cfg.coordinates = 'spm, 'ctf' or empty for interactive (default = []) cfg.parameter='pow'; cfg.filename=filename; cfg.filetype = 'spm'; cfg.spmversion = 'SPM8'; % capitalized after first error message from vers 6 % cfg.dataformat='nifti'; % added after first error message from vers 6 % commented out after 2nd error message from vers 6 %cfg.vmpversion=2; % this is a filetype, like spm, so don't need to specify unless cfg.filetyp='vmp' cfg.coordinates='spm'; ft_volumewrite(cfg,sourcetempIntN); On Wed, Feb 23, 2011 at 7:50 AM, jan-mathijs schoffelen wrote: Dear Jen, I notice that indeed in the documentation section of ft_write_volume there is a FIXME behind nifti. Yet, nifti format seems to be supported by ft_write_volume (at least in a recent version of fieldtrip). Did you try it at all (and ran into problems) or were you held back by the FIXME statement? Could you just try it out using a recent fieldtrip function? Thanks and best wishes Jan-Mathijs On Feb 23, 2011, at 2:21 AM, Jen Whitman wrote: Hello, While writing beamformed images to spm2 format in a previous version of fieldtrip (now lost due to a computer crash), I was able to get nice-looking results; networks of brain regions consistent with existing literature. When I try to write images from the same dataset and the same analysis to spm8 format, my results (t-images computed across subjects) end up being single clusters spanning large sections of the brain (e.g. a 'blob' spanning all of one hemisphere but not the other). Unfortunately, some aspects of my planned data analyses cannot be performed on spm2 images, so I have to find a way of writing to successfully to nifti format. I just noticed that in the comments in the ft_write_volume function, which I am calling via ft_volumewrite, it says 'FIXME' next to nifti under the list of supported dataformats. Is there by any chance a patch out there for writing nifti images? Thanks! _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 -------------- next part -------------- An HTML attachment was scrubbed... URL: From r.oostenveld at donders.ru.nl Thu Apr 14 15:04:27 2011 From: r.oostenveld at donders.ru.nl (Robert Oostenveld) Date: Thu, 14 Apr 2011 15:04:27 +0200 Subject: [FieldTrip] Fwd: BCI in 2011 and 8th BCI2000 workshop: Early Registration Deadline April 20th References: Message-ID: Dear Colleague, Please note that the early registration-deadline for the two-day symposium 'Brain-Computer Interfacing in 2011' and the 8th BCI2000 workshop is approaching fast. After April 20th, participation is subject to increased registration fees. If you are interested in interfacing with the human brain, and would like to learn about the future directions of BCI research, register now on www.bci2011.eu. Yours Sincerely, The Organizing Committee Mariska van Steensel ‘Brain-Computer Interfacing in 2011’ What is this? A two-day symposium on Brain-Computer Interfacing When and Where? Utrecht, Netherlands, May 20&21, 2011 By Whom? UMC Utrecht/Rudolf Magnus Institute and the BrainGain Consortium For Whom? Anyone interested in: Human Brain Function Interfacing with the human brain and mind Developing solutions for paralyzed patients Who speaks? Brendan Allison, Bernhard Graimann, Eberhard Fetz, Beata Jarosiewicz, Jean-Philippe Lachaux, Eric Leuthardt, Phil Kennedy, Christa Neuper, Nick Ramsey, Gerwin Schalk, Bill Shain, Andrew Schwartz, Jonathan Wolpaw For more information, please visit www.bci2011.eu The 8th BCI2000 workshop What is this? A two-day workshop on Brain-Computer Interfacing and BCI2000 When and Where? Utrecht, Netherlands, May 18&19, 2011 By Whom? UMC Utrecht/Rudolf Magnus Institute and BCI2000 For Whom? Anyone interested in: Human Brain Function Interfacing with the human brain and mind Developing solutions for paralyzed patients Program: Lectures that describe relevant technical aspects of the BCI2000 system including implementation with C ++, Matlab, Fieldtrip or Python. Hands‐on practical tutorials where participants use BCI systems to control a cursor on a computer screen and to spell words just by thinking. Exercises, in which participants build and configure a BCI with their own signal processing methods, applications, or assistive devices. For more information, please visit www.bci2011.eu > De informatie opgenomen in dit bericht kan vertrouwelijk zijn en is uitsluitend bestemd voor de geadresseerde. Indien u dit bericht onterecht ontvangt, wordt u verzocht de inhoud niet te gebruiken en de afzender direct te informeren door het bericht te retourneren. Het Universitair Medisch Centrum Utrecht is een publiekrechtelijke rechtspersoon in de zin van de W.H.W. (Wet Hoger Onderwijs en Wetenschappelijk Onderzoek) en staat geregistreerd bij de Kamer van Koophandel voor Midden-Nederland onder nr. 30244197. Denk s.v.p aan het milieu voor u deze e-mail afdrukt. This message may contain confidential information and is intended exclusively for the addressee. If you receive this message unintentionally, please do not use the contents but notify the sender immediately by return e-mail. University Medical Center Utrecht is a legal person by public law and is registered at the Chamber of Commerce for Midden-Nederland under no. 30244197. Please consider the environment before printing this e-mail. -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: attbab2f.gif Type: image/gif Size: 15792 bytes Desc: not available URL: From luoj at mail.nih.gov Thu Apr 14 18:00:52 2011 From: luoj at mail.nih.gov (Luo, Jessie (NIH/NIMH) [C]) Date: Thu, 14 Apr 2011 12:00:52 -0400 Subject: [FieldTrip] FT_READ_EVENT Message-ID: Hi experts, Can FT_READ_EVENT handle 4D data (it does not seem to be so based on the documentation)? Working on getting fieldtrip to sort out different cognitive conditions based on trigger values. Any input or suggestion on what program to use is appreciated. Thanks, Jessie From daniele.marinazzo at ugent.be Thu Apr 14 20:53:08 2011 From: daniele.marinazzo at ugent.be (Daniele Marinazzo) Date: Thu, 14 Apr 2011 20:53:08 +0200 Subject: [FieldTrip] PhD position - analysis of neuroimaging data In-Reply-To: References: Message-ID: The PhD student will be part of a research group focusing on the development and validation of new methods for the analysis of neuroimaging data. The position is financed by the Multidisciplinary Research Project "The Integrative Neuroscience of Behavioural Control", an ambitious collaboration with experimental psychologists and clinical doctors. We are looking for a highly motivated candidate, who has ideally a master degree in physics, mathematics or engineering, knows at least one programming language (matlab, R, C, etc) and has an interest for multidisciplinary research. Anyway candidates with a medical/biological background and some programming expertise are also welcome to apply. If you wish to apply for this position, please send an email with a letter explaining why you wish to do research on this theme, a CV and publication list, if any, to Daniele Marinazzo (daniele.marinazzo at ugent.be). The selections will go on until the position is filled. For more information (including the details of the project proposal), please feel free to contact Daniele Marinazzo (daniele.marinazzo at ugent.be). -- Daniele Marinazzo -- http://www.da.ugent.be Department of Data Analysis, Gent University Henri Dunantlaan 1, B-9000 Gent, Belgium -------------- next part -------------- An HTML attachment was scrubbed... URL: From luoj at mail.nih.gov Thu Apr 14 21:35:32 2011 From: luoj at mail.nih.gov (Luo, Jessie (NIH/NIMH) [C]) Date: Thu, 14 Apr 2011 15:35:32 -0400 Subject: [FieldTrip] FT_READ_EVENT In-Reply-To: <7180e5c062dbf.4da6e0c2@mail.uh.edu> References: , <7180e5c062dbf.4da6e0c2@mail.uh.edu> Message-ID: Yes you are right. Thanks Mehmet! Jessie ________________________________________ From: mcoskun at mail.uh.edu [mcoskun at mail.uh.edu] Sent: Thursday, April 14, 2011 12:55 PM To: Luo, Jessie (NIH/NIMH) [C] Subject: Re: [FieldTrip] FT_READ_EVENT Hi Jessie, I have tried this long time ago and it does handle 4D data. I just checked the .m file for ft_read_event and 4D format is implemented actually. Mehmet ----- Original Message ----- From: "Luo, Jessie (NIH/NIMH) [C]" Date: Thursday, April 14, 2011 11:09 am Subject: [FieldTrip] FT_READ_EVENT To: "fieldtrip at donders.ru.nl" > Hi experts, > > Can FT_READ_EVENT handle 4D data (it does not seem to be so > based on the documentation)? Working on getting fieldtrip to > sort out different cognitive conditions based on trigger values. > Any input or suggestion on what program to use is appreciated. > > Thanks, > Jessie > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip From jan.schoffelen at donders.ru.nl Thu Apr 14 21:46:55 2011 From: jan.schoffelen at donders.ru.nl (jan-mathijs schoffelen) Date: Thu, 14 Apr 2011 21:46:55 +0200 Subject: [FieldTrip] FT_READ_EVENT In-Reply-To: References: Message-ID: <80088F6E-2E4E-40A2-A899-C90E023FECCD@donders.ru.nl> Hi Jessie, 4D data is fully supported in FieldTrip. If the documentation suggests otherwise, that's incorrect. To get started, you can have a look here: http://fieldtrip.fcdonders.nl/tutorial/preprocessing http://fieldtrip.fcdonders.nl/walkthrough Good luck, Jan-Mathijs On Apr 14, 2011, at 6:00 PM, Luo, Jessie (NIH/NIMH) [C] wrote: > Hi experts, > > Can FT_READ_EVENT handle 4D data (it does not seem to be so based on > the documentation)? Working on getting fieldtrip to sort out > different cognitive conditions based on trigger values. Any input or > suggestion on what program to use is appreciated. > > Thanks, > Jessie > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 From luoj at mail.nih.gov Thu Apr 14 21:55:34 2011 From: luoj at mail.nih.gov (Luo, Jessie (NIH/NIMH) [C]) Date: Thu, 14 Apr 2011 15:55:34 -0400 Subject: [FieldTrip] FT_READ_EVENT In-Reply-To: <80088F6E-2E4E-40A2-A899-C90E023FECCD@donders.ru.nl> References: , <80088F6E-2E4E-40A2-A899-C90E023FECCD@donders.ru.nl> Message-ID: Thanks Jan-Mathijs! Jessie ________________________________________ From: jan-mathijs schoffelen [jan.schoffelen at donders.ru.nl] Sent: Thursday, April 14, 2011 3:46 PM To: Email discussion list for the FieldTrip project Subject: Re: [FieldTrip] FT_READ_EVENT Hi Jessie, 4D data is fully supported in FieldTrip. If the documentation suggests otherwise, that's incorrect. To get started, you can have a look here: http://fieldtrip.fcdonders.nl/tutorial/preprocessing http://fieldtrip.fcdonders.nl/walkthrough Good luck, Jan-Mathijs On Apr 14, 2011, at 6:00 PM, Luo, Jessie (NIH/NIMH) [C] wrote: > Hi experts, > > Can FT_READ_EVENT handle 4D data (it does not seem to be so based on > the documentation)? Working on getting fieldtrip to sort out > different cognitive conditions based on trigger values. Any input or > suggestion on what program to use is appreciated. > > Thanks, > Jessie > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip From mcoskun at mail.uh.edu Fri Apr 15 08:58:07 2011 From: mcoskun at mail.uh.edu (Mehmet-Akif Coskun) Date: Fri, 15 Apr 2011 01:58:07 -0500 Subject: [FieldTrip] dipole waveform scale Message-ID: <7260941e607dc.4da7a62f@mail.uh.edu> Dear Fieldtrippers, The input data scaling for averaged data is in Tesla, but i wonder what is the units and the scale for dipole waveforms. When i checked the meg_leadfield1 m file, at the end leadfields are multiplied by 1e-7. Where this factor comes from? Thanks Mehmet Hope that helps. I'm thinking that if your gradiometer data scaling is in meters (check your grad structure) and the input data scaling to the last dot operation is in fT, then your output scale will be A-m (1e-9), but you might want to check since I didn't confirm that. I think by default the fieldtrip MEG data are in units of T so you might need to scale your input data accordingly to get your desired output scale. But then, I'm assuming MEG gradiometer data input, so if you have something else, check your function call to ft_compute_leadfield and adjust your scaling accordingly -------------- next part -------------- An HTML attachment was scrubbed... URL: From Hanneke.vanDijk at med.uni-duesseldorf.de Fri Apr 15 11:34:20 2011 From: Hanneke.vanDijk at med.uni-duesseldorf.de (Hanneke van Dijk) Date: Fri, 15 Apr 2011 11:34:20 +0200 Subject: [FieldTrip] I think you solved the problem In-Reply-To: <72E993C35FB11743B79FF9286E5B6D8B02676493@Mail2-UKD.VMED.UKD> References: <72E993C35FB11743B79FF9286E5B6D8B02676142@Mail2-UKD.VMED.UKD> <7B5CA863-D143-404C-BCB9-805AA6E6E546@donders.ru.nl> <72E993C35FB11743B79FF9286E5B6D8B02676264@Mail2-UKD.VMED.UKD> <72E993C35FB11743B79FF9286E5B6D8B026763B8@Mail2-UKD.VMED.UKD> <5AC469DB-D5B1-4E3C-AE21-01A53AE94A26@donders.ru.nl> <72E993C35FB11743B79FF9286E5B6D8B02676493@Mail2-UKD.VMED.UKD> Message-ID: Dear Jan and Jan-Mathijs, Thanks for working on this problem! I'm testing it for data recorded with the 'old' neuromag 122 system. I'm using the script that Jan attached to a previous e-mail, and the fieldtrip version that was released yesterday. The first question that I have is: What to do if you don't have fiducial information from the neuromag software? I could use ft_volume_realign with cfg.method = 'interactive' and point the fiducials out and swap the y and x axes. But in what coordinate system am I then, and in what coordinate system should I move on? second, My 'vol' , headmodel, seems to end up in a factor 10 (or more(?)) smaller unit then the grid and grad. You can't even see it in the headmodelplot (it is a small dot somewhere in the middle). I don't know what happened there. third, If you look at the picture I attached the grid is not in the centre of the helmet (pic1 from the top down), and very low (pic2 looking from the left). I don't know how to solve that. I at least think the subject was not in the helmet that way! Groetjes Hanneke -------------------------------------------------- Dr. Hanneke van Dijk Institut für Klinische Neurowissenschaften und Medizinische Psychologie Gebäude-Nr.: 23.02 Ebene: 03 Zimmer-Nr.: 47 Tel.: +49 211-81-13074 Mail : hanneke.vandijk at med.uni-duesseldorf.de http://www.uniklinik-duesseldorf.de/deutsch/unternehmen/institute/KlinNeurowiss/Team/HannekevanDijk/page.html On Thu, Apr 14, 2011 at 9:31 AM, wrote: > Dear Jan-Mathijs, > > > > sure, I will do that. I have tested one head model with > ft_dipole_simulation and beamforming and it looks good (at least when I > simulate two conditions and subtract sources the right location comes out). > So I guess we (and maybe others) will use the new procedure now. > > > > Best, > > jan > > > ------------------------------ > > *Von:* fieldtrip-bounces at donders.ru.nl [mailto: > fieldtrip-bounces at donders.ru.nl] *Im Auftrag von *jan-mathijs schoffelen > *Gesendet:* Mittwoch, 13. April 2011 16:57 > *An:* Email discussion list for the FieldTrip project > *Betreff:* Re: [FieldTrip] I think you solved the problem > > > > Dear Jan, > > > > No problem. Thanks for the script. If you feel up to it, you are kindly > invited to update the documentation on the fieldtrip wiki as well. If I > recall correctly, at some point Hanneke added some documentation about how > to create MNI-based dipole grids for neuromag data. A lot of the > intermediate steps have now become obsolete and this part of the wiki can be > substantially cleaned. > > > > Thanks, > > > > Jan-Mathijs > > > > > > On Apr 13, 2011, at 2:31 PM, < > Jan.Hirschmann at med.uni-duesseldorf.de> wrote: > > > > Dear Jan-Mathijs, > > > > I think we solved the problem. Everthing is like you said in the first > place. ft_volumerealign and ft_volumesegment should be called with > cfg.coordsys=’neuromag’. The only thing that was wrong is that for the voxel > coordinates read from the Neuromag GUI x and y should be swapped. For anyone > interested I attach a script that is meant to be easy-to-use for beginners. > > > > Thank you very much for your time! > ------------------------------ > > *Von:* fieldtrip-bounces at donders.ru.nl [ > mailto:fieldtrip-bounces at donders.ru.nl ] > *Im Auftrag von *jan-mathijs schoffelen > *Gesendet:* Dienstag, 12. April 2011 21:18 > *An:* Email discussion list for the FieldTrip project > *Betreff:* Re: [FieldTrip] I think you solved the problem > > > > Dear Jan, > > > > I suspect that your mri, as it comes out of ft_read_mri is already > coregistered in neuromag space. After your realignment and after replacing > mri.transform with real_mri.transform, the coordinate axes in your pic1 look > strange. This I think causes the 'dropped pocket change'. > > What happens if you skip the ft_volumerealign step and call > ft_volumesegment directly on the mri (with cfg.coordsys = 'neuromag', or, > for what it's worth, without cfg.coordsys; in this case you will be able to > verify the coordinate system)? > > Alternatively, if this doesn't work, could you replace mri.transform by > eye(4) prior to calling ft_volumerealign and ft_volumesegment (both with > cfg.coordsys = 'neuromag' and no further tampering with transformation > matrices?). > > > > Thanks > > > > JM > > > > > > On Apr 12, 2011, at 8:49 PM, < > Jan.Hirschmann at med.uni-duesseldorf.de> wrote: > > > > > Dear Jan-Mathijs, > > > > sorry, I think I was a bit too enthusiastic when I said everything worked > out wonderfully. It worked only once. After an afternoon of confusion I > concluded that on my first try I must have misspelled > cfg.coordsys=’neuromag’ on my calls to ft_volumerealign and > ft_volumesegment. In fact, the segmentation looks really bad with these > settings. What works for me is written underneath: > > > > mri = ft_read_mri('….fif'); > > hdr=ft_read_header('…fif'); > > mri.anatomy=double(mri.anatomy); > > > > %this is taken from the Neuromag GUI for MRI-MEG Integration > > cfg=[]; > > cfg.fiducial.rpa=[136.35 142.80 31.96]; > > cfg.fiducial.nas=[47.84 101.80 100.10]; > > cfg.fiducial.lpa=[139.22 146.17 162.69]; > > > > %go from neuromag voxel to neuromag head coordinates > > cfg.coordsys='neuromag'; > > cfg.method='fiducial'; > > real_mri=ft_volumerealign(cfg,mri); > > > > %taking real_mri with its coordsys field will not work, so I take mri > > mri.transform=real_mri.transform; > > > > cfg = []; > > cfg.keepintermediate = 'no'; > > cfg.write = 'no'; > > segmentedmri = ft_volumesegment(cfg, mri); > > > > > > Before segmentation the function shows some kind of brain (pic 1). When > segmentation is done the segmented brain looks good (pic 2) but the brain > does not fit the helmet (pic 3). It is looking at its feet as if it dropped > some pocket change. Do you know what is going on? > > > > Thanks, > > jan > > > ------------------------------ > > *Von:* fieldtrip-bounces at donders.ru.nl [ > mailto:fieldtrip-bounces at donders.ru.nl ] > *Im Auftrag von *jan-mathijs schoffelen > *Gesendet:* Dienstag, 12. April 2011 12:11 > *An:* Email discussion list for the FieldTrip project > *Betreff:* Re: [FieldTrip] I think you solved the problem > > > > Dear Jan, > > > > Apart from not being properly aligned, the segmentation looks a bit strange > to me. I suspect that not everything went well here ;o). > > Could you try the following: > > > > specify cfg.coordsys = 'neuromag', both in your call to ft_volumerealign > and in your call to ft_volumesegment. The cfg.coordinates for > ft_volumesegment has to be removed (actually it is a deprecated option). The > idea now is that mri-structures in fieldtrip can have a coordsys field, > which allows for more transparent use of the different head coordinate > system conventions. This takes away the need for intermediately > coregistering the MRI in 'ctf'-convention, and would also take away your > need to call headcoordinates later on. > > > > Best wishes, > > > > Jan-Mathijs > > > > > > On Apr 12, 2011, at 11:07 AM, < > Jan.Hirschmann at med.uni-duesseldorf.de> wrote: > > > > > > Dear fieldtrip experts, > > > > I have two questions regarding head model creation. As noted on this > thread, the volumesegment function was updated and I tested it for our > Neuromag data. The segmentation is performed, but unfortunately it is not > aligned with the MRI in my case. Here is the code I am using, the fieldtrip > is from 9th April 2011. > > > > %read mri > > mri = ft_read_mri(subject_files.fiff_mri); > > mri.anatomy=double(mri.anatomy); > > > > %these are the fiducials for this subject taken from the Neuromag GUI for > coregistration > > cfg=[]; > > cfg.fiducial.rpa=[136.35 142.80 31.96]; > > cfg.fiducial.nas=[47.84 101.80 100.10]; > > cfg.fiducial.lpa=[139.22 146.17 162.69]; > > > > %define the head coordinate system according to CTF conventions > > cfg.method='fiducial'; > > real_mri=ft_volumerealign(cfg,mri); > > > > %segment > > cfg = []; > > cfg.template = '/data/apps/spm/spm8/templates/T1.nii'; > > cfg.coordinates = 'ctf'; > > cfg.keepintermediate = 'no'; > > segmentedmri = ft_volumesegment(cfg, real_mri); > > > > %plot white matter > > test=segmentedmri; > > test.anatomy=real_mri.anatomy; > > cfg=[]; > > cfg.funparameter='white'; > > ft_sourceplot(cfg,test); %see attached picture > > > > The other issue regards back-transformation from CTF to Neuromag > coordinates, which is necessary to make the head model fit the sensors. My > idea was to create an appropriate transformation matrix like this. > > > > cd /net/avidya/storage/home/jan/fieldtrip-20110409/private > > ctfmat=headcoordinates(nas,lpa,rpa,'ctf'); > > nmmat=headcoordinates(nas,lpa,rpa,'neuromag'); > > ctf_to_nm=nmmat/ctfmat; > > > > > > And then to use it on the head model to bring it back into Neuromag > coordinates: > > > > %create single shell, realistic headmodel > > cfg = []; > > hdm = ft_prepare_singleshell(cfg,segmentedmri); > > > > % transformation of headmodel into Neuromag space > > hdm.bnd.pnt=warp_apply(ctf_to_nm,hdm.bnd.pnt,'homogeneous'); > > > > Does this survive a sanity check? > > > > Best regards and thanks a lot, > > > > Jan > > > > > ------------------------------ > > *Von:* fieldtrip-bounces at donders.ru.nl [ > mailto:fieldtrip-bounces at donders.ru.nl ] > *Im Auftrag von *Jen Whitman > *Gesendet:* Montag, 28. Februar 2011 22:32 > *An:* Email discussion list for the FieldTrip project > *Betreff:* [FieldTrip] I think you solved the problem > > > > I just checked, and when I re-ran my segmentation script with the new > Fieldtrip in order to use an spm8 template image, coordinates got reversed. > When I take out the calls to flipdim, they look fine (see attached > screenshots). That certainly explains the meaningless results I was getting! > > Thanks for figuring that out, > > Jen > > On Mon, Feb 28, 2011 at 12:36 PM, jan-mathijs schoffelen < > jan.schoffelen at donders.ru.nl> wrote: > > Hi Jen, > > > > At first glance I have a comment on your script. You may need to explicitly > check the alignment of your segmented volume and the original anatomy. A > while a go some changes were made to ft_volumesegment, taking away the need > to do the flipdim(flipdim... operations. I have posted this on the > discussion list last January, but you may not have noticed. > > Anyway, if you now have used a recent version of FieldTrip for your > segmentation both the location of your dipole grid, and the volume conductor > model will not be adequately coregistered with the data, which may lead to > funky results to begin with. That's most likely not related to the filetype > in which the volumes are saved for later use. > > > > Best wishes, > > > > Jan-Mathijs > > > > > > > > On Feb 28, 2011, at 8:59 PM, Jen Whitman wrote: > > > > > > > Hello Jan, > > When calling volumesegment, I specified 'ctf' as the coordinate system. The > function I wrote to call volumesegment and prepare_singleshell for each > subject and save the results is pasted below, with a couple of comments > added for clarity. > Over the weekend I tried specifying the coordinate system in the call to > ft_volumenormalise as 'ctf' rather than 'spm', and commented out all the > lines that said cfg.spmversion = 'spm8'; before calling a function. However, > that created worse results, as each plot involved stripes of activation and > empty voxels, suggesting that 'ctf' was not the correct coordinate system to > specify. > > Thanks for the attached script. Looking in that the comments in that, I > suspect that the solution to my problems will be to specify my filetype as > nifti_img rather than nifti. I'll let you know how that goes. > > Jen > > > ------------------------------------------------------------------------------------------------------------ > % the variable subj is simply a string consisting of a subject number (e.g. > 's05') which can be a folder name or part of a filename > function [vol mri segmentedmri > segmentedmriF]=call_volume_segment_function_spm8(subj) > cfg.spmversion = 'spm8'; > cfg.template = '/home/woodwardlab/spm8/templates/EPI.nii'; > %cfg.template='/home/common/matlab/spm2/templates/T1.mnc'; > cfg.name=[subj '_volseg']; > cfg.write='yes'; > cfg.smooth='no'; > cfg.coordinates='ctf'; > mri=read_mri([subj '/mri/' subj 'head.mri']); % made with CTF mriConverter > and mriViewer software, after fiducials were marked > segmentedmri = volumesegment(cfg, mri); > segmentedmriF = segmentedmri; > segmentedmriF.gray = flipdim(flipdim(flipdim(segmentedmriF.gray,3),2),1); > segmentedmriF.white = flipdim(flipdim(flipdim(segmentedmriF.white,3),2),1); > segmentedmriF.csf = flipdim(flipdim(flipdim(segmentedmriF.csf,3),2),1); > segmentedmriF.transform = mri.transform; > segmentedmriF.anatomy = mri.anatomy; > cfg = []; > cfg.spmversion = 'spm8'; > vol = prepare_singleshell(cfg, segmentedmriF); > eval(['save ' subj '/meg/mrisegmented.mat mri segmentedmri segmentedmriF > vol']) > > > > > > On Sat, Feb 26, 2011 at 5:26 AM, jan-mathijs schoffelen < > jan.schoffelen at donders.ru.nl> wrote: > > Dear Jen, > > > > I do not manage to reproduce your issue, when only focussing on the > ft_volumewrite and visualization part of your pipeline. See attached script, > and yet an updated version of ft_volumewrite which you need to (hopefully) > draw the same conclusion as I did. > > Yet, I only now realize that your question may pertain to the entire > pipeline. It could be that something is going wrong there. > > I only see now that in the part of your script of which you reported that > it gave 'good' results, you specify cfg.coordinates = 'ctf' before calling > ft_volumenormalise. I assume this is correct, because the coordinate system > your source-reconstructed data lives in, is according to the CTF-convention, > and not according to the SPM-convention. On the other hand, the template for > the spatial normalization lives in the SPM-coordinate system. In order for > the spatial normalization to work OK, Fieldtrip tries to convert from one > coordinate system to the other (once again, this is appropriate behaviour), > before doing the actual normalization. It seems that at least in the script > you sent along, in the final (not working version), you specified > cfg.coordinates = 'spm' prior to calling ft_volumenormalise. This is > probably wrong. > > Another important point that should be mentioned, is that the coordinate > systems in which the functional data and the anatomical data live should be > the same for the ft_sourceinterpolate to make sense. In other words, if your > source reconstructed images are defined on a 3D grid of positions in > CTF-space, the mri.transform of your anatomy should describe a > transformation from voxel to CTF-space. > > I think you may want to revisit step by step this part of the pipeline; I > don't think the problem lies in the writing. > > A final possibility of course is that Mricron is misbehaving... > > > > Best, > > > > Jan-Mathijs > > > > > > > > > > > > > > On Feb 25, 2011, at 9:44 PM, Jen Whitman wrote: > > > > > > > Hi Jan, > > I tried re-running the analysis with the new script you sent me, and the > latest version of fieldtrip (since I needed ft_get_opt as well), but the > spm8 images being written are still producing flawed results. It's the same > problem as I mentioned briefly in my previous post. I am not getting any > error messages when writing these images. Rather, my problem is that the > spm8 and spm2 results from the same data ought to be identical when viewed > in mricron, but they're far from it. When I use mricron to look at the > results from the spm8-format images, combined across participants to create > a t-image, I just get a single 'blob' spanning roughly half the brain. In > contrast, when I used spm2-format previously on the same data, the t-image > was much more meaningful; a posterior alpha power decrease in a set of > regions corresponding to the 'task-positive network' (a network found in the > results of an fMRI version of my experiment, and widely reported in the fMRI > literature). > > This failure to replicate the spm2 results when using spm8 images from the > same data leads me to suspect that something is wrong with the coordinates > for spm8 format. However, after experimenting extensively with different cfg > options I still haven't identified the problem. If I my structural MRIs have > been saved to .mri files using CTF's MRIConverter program, which cfg > options, particularly for coordinates, template images, and filetypes, > should I specify before calling the ft_volumesegment, > ft_prepare_singleshell, ft_sourceinterpolate, ft_volumenormalise, and > ft_volumewrite functions? Or should I be calling a different set of > functions now? > > Thanks again for your help, > > Jen > > On Thu, Feb 24, 2011 at 10:07 AM, Jen Whitman > wrote: > > Great, thanks! > > I'll start the analysis with your new script today and will let you know > how it works out. > > Jen > > On Thu, Feb 24, 2011 at 4:44 AM, jan-mathijs schoffelen < > jan.schoffelen at donders.ru.nl> wrote: > > Dear Jen, > > > > I managed to reproduce your problem. The code was rather buggy and indeed > ft_volumewrite did not behave as it should have. I now fixed it in the code > and it should run fine now. Please find the updated file attached. It will > be available on our ftp-server as of tonight. Please note that I updated the > documentation, and changed the names of some of the options a bit. If you > want to save your data in analyze-format, you should specify cfg.filetype = > 'analyze_spm'. If you specify cfg.filetype = 'nifti', it should write out a > volume to nifti-format, using SPM8. > > > > Best wishes, > > > > Jan-Mathijs > > > > > > > > > > > > On Feb 23, 2011, at 7:44 PM, Jen Whitman wrote: > > > > > Dear Jan, > > Thanks for the quick reply. Yes, I have tried it out quite a few times now, > experimenting with different settings in the cfgs. Below I'll paste the code > I've been using to write images - first the code that successfully created > spm2 images that produced good results, then the code used for creating > nifti format images from the same data. The comments in this second part are > at this point a bit of a maze of cfg options I've been changing back & > forth. Any insights/suggestions regarding how to set up my cfgs to make this > work would be greatly appreciated. > > Jen > > > %%%%%%%% this code generated spm2-compatible images which did work > (producing results that made sense). > > %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% > > sourcetemp.avg.pow = (sourcetemp.avg.pow - sourcePre.avg.pow) ./ > sourcePre.avg.pow; > > cfg = []; > cfg.downsample = 2; > sourcetempInt = sourceinterpolate(cfg, sourcetemp , mri); > > % projecting the plot onto a surface... > cfg = []; > cfg.coordinates = 'ctf'; > cfg.template = '/home/common/matlab/spm2/templates/T1.mnc'; %this > template is in MNI coordinates > sourcetempIntN = volumenormalise(cfg, sourcetempInt); > > filename=[subj 'run' int2str(r) 'cond' int2str(cond) '_' int2str(f) > 'HzWin' int2str(win) 'width750ms']; > cfg=[]; > cfg.parameter = 'avg.pow'; % string, describing the functional data > to be processed, e.g. 'pow', 'coh' or 'nai' > cfg.filename = [filename '.img']; %'testimageoutput_alphafreq'; % > filename without the extension > cfg.filetype = 'spm'; %'analyze', 'spm', 'vmp' or 'vmr' > cfg.coordinates = 'spm'; %'spm, 'ctf' or empty for interactive > (default = []) > cfg.datatype = 'double'; %'float'; %'double'; %'bit1', 'uint8', > 'int16', 'int32', 'float' or 'double' > > volumewrite(cfg, sourcetempIntN) > > > > %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% > > %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% > > %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% > > %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% > %%%%% this code below hasn't worked yet... > > % I added cfg.spmversion = 'spm8'; > % in the cfgs for the calls to ft_prepare_leadfield and ft_sourceanalysis, > % and in the call to prepare_singleshell after calling volumesegment > > % I've also ensured that spm8 is the only spm version in my path, even in > % the fieldtrip/external folder, and ensured that spm8 is installed > properly > % (files compiled correctly, etc..) > > sourcetemp.avg.pow = (sourcetemp.avg.pow - sourcePre.avg.pow) ./ > sourcePre.avg.pow; > > filename=[subj 'run' int2str(r) 'cond' int2str(cond) '_' int2str(f) > 'Hzspm8_FIXv9_Win' int2str(win) 'width750ms.img']; > > cfg = []; > % cfg.coordinates = 'spm'; % changed for version 5 > % cfg.spmversion = 'spm8'; % changed for version 5 > cfg.downsample = 4; > sourcetempInt = ft_sourceinterpolate(cfg, sourcetemp , mri); > > > % projecting the plot onto a surface... > cfg = []; > %cfg.coordinates = 'spm'; % changed for version 5 > %cfg.coordinates = 'ctf'; % changed for version 5 > cfg.coordinates = 'spm'; % changed back to spm for version 9 > cfg.downsample = 4; > %cfg.spmversion = 'spm8'; % changed for version 6 (because this gets > specified in volumewrite) > cfg.template = 'Hmatrix/mask.nii.nii'; % basically equivalent to using > spm8/templates/EPI.nii, except that mask.nii (produced from fmri data) has > the desired voxel size > % cfg.name = [filename]; % changed for version 6 > %cfg.write= 'yes'; % changed for version 6 (when this was set to 'yes' > there was no subsequent call to volumewrite) > cfg.write= 'no'; % changed for version 6 > sourcetempIntN = ft_volumenormalise(cfg, sourcetempInt); > > % this whole cfg and function call added for version 6 > cfg=[]; > % cfg.parameter = string, describing the functional data to be > processed, e.g. 'pow', 'coh' or 'nai' > % cfg.filename = filename without the extension > % cfg.filetype = 'analyze', 'spm', 'vmp' or 'vmr' > % cfg.vmpversion = 1 or 2 (default) version of the vmp-format to use > % cfg.coordinates = 'spm, 'ctf' or empty for interactive (default = []) > cfg.parameter='pow'; > cfg.filename=filename; > cfg.filetype = 'spm'; > cfg.spmversion = 'SPM8'; % capitalized after first error message from > vers 6 > % cfg.dataformat='nifti'; % added after first error message from vers 6 > % commented out after 2nd error message > from vers 6 > %cfg.vmpversion=2; % this is a filetype, like spm, so don't need to > specify unless cfg.filetyp='vmp' > cfg.coordinates='spm'; > ft_volumewrite(cfg,sourcetempIntN); > > > > > > > > On Wed, Feb 23, 2011 at 7:50 AM, jan-mathijs schoffelen < > jan.schoffelen at donders.ru.nl> wrote: > > Dear Jen, > > I notice that indeed in the documentation section of ft_write_volume there > is a FIXME behind nifti. Yet, nifti format seems to be supported by > ft_write_volume (at least in a recent version of fieldtrip). Did you try it > at all (and ran into problems) or were you held back by the FIXME statement? > Could you just try it out using a recent fieldtrip function? > > Thanks and best wishes > > Jan-Mathijs > > > > > On Feb 23, 2011, at 2:21 AM, Jen Whitman wrote: > > Hello, > > While writing beamformed images to spm2 format in a previous version of > fieldtrip (now lost due to a computer crash), I was able to get nice-looking > results; networks of brain regions consistent with existing literature. When > I try to write images from the same dataset and the same analysis to spm8 > format, my results (t-images computed across subjects) end up being single > clusters spanning large sections of the brain (e.g. a 'blob' spanning all of > one hemisphere but not the other). Unfortunately, some aspects of my planned > data analyses cannot be performed on spm2 images, so I have to find a way of > writing to successfully to nifti format. > > I just noticed that in the comments in the ft_write_volume function, which > I am calling via ft_volumewrite, it says 'FIXME' next to nifti under the > list of supported dataformats. Is there by any chance a patch out there for > writing nifti images? > > Thanks! > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > > > Dr. J.M. (Jan-Mathijs) Schoffelen > Donders Institute for Brain, Cognition and Behaviour, > Centre for Cognitive Neuroimaging, > Radboud University Nijmegen, The Netherlands > J.Schoffelen at donders.ru.nl > Telephone: 0031-24-3614793 > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > > > > Dr. J.M. (Jan-Mathijs) Schoffelen > > Donders Institute for Brain, Cognition and Behaviour, > Centre for Cognitive Neuroimaging, > Radboud University Nijmegen, The Netherlands > > J.Schoffelen at donders.ru.nl > > Telephone: 0031-24-3614793 > > > > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > > > > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > > > > Dr. J.M. (Jan-Mathijs) Schoffelen > > Donders Institute for Brain, Cognition and Behaviour, > Centre for Cognitive Neuroimaging, > Radboud University Nijmegen, The Netherlands > > J.Schoffelen at donders.ru.nl > > Telephone: 0031-24-3614793 > > > > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > > > > Dr. J.M. (Jan-Mathijs) Schoffelen > > Donders Institute for Brain, Cognition and Behaviour, > Centre for Cognitive Neuroimaging, > Radboud University Nijmegen, The Netherlands > > J.Schoffelen at donders.ru.nl > > Telephone: 0031-24-3614793 > > > > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > > > > > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > > > > Dr. J.M. (Jan-Mathijs) Schoffelen > > Donders Institute for Brain, Cognition and Behaviour, > Centre for Cognitive Neuroimaging, > Radboud University Nijmegen, The Netherlands > > J.Schoffelen at donders.ru.nl > > Telephone: 0031-24-3614793 > > > > > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > > > > Dr. J.M. (Jan-Mathijs) Schoffelen > > Donders Institute for Brain, Cognition and Behaviour, > Centre for Cognitive Neuroimaging, > Radboud University Nijmegen, The Netherlands > > J.Schoffelen at donders.ru.nl > > Telephone: 0031-24-3614793 > > > > > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > > > > Dr. J.M. (Jan-Mathijs) Schoffelen > > Donders Institute for Brain, Cognition and Behaviour, > Centre for Cognitive Neuroimaging, > Radboud University Nijmegen, The Netherlands > > J.Schoffelen at donders.ru.nl > > Telephone: 0031-24-3614793 > > > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: pic1.jpg Type: image/jpeg Size: 22308 bytes Desc: not available URL: From Hanneke.vanDijk at med.uni-duesseldorf.de Fri Apr 15 12:38:56 2011 From: Hanneke.vanDijk at med.uni-duesseldorf.de (Hanneke van Dijk) Date: Fri, 15 Apr 2011 12:38:56 +0200 Subject: [FieldTrip] I think you solved the problem In-Reply-To: References: <72E993C35FB11743B79FF9286E5B6D8B02676142@Mail2-UKD.VMED.UKD> <7B5CA863-D143-404C-BCB9-805AA6E6E546@donders.ru.nl> <72E993C35FB11743B79FF9286E5B6D8B02676264@Mail2-UKD.VMED.UKD> <72E993C35FB11743B79FF9286E5B6D8B026763B8@Mail2-UKD.VMED.UKD> <5AC469DB-D5B1-4E3C-AE21-01A53AE94A26@donders.ru.nl> <72E993C35FB11743B79FF9286E5B6D8B02676493@Mail2-UKD.VMED.UKD> Message-ID: sorry, forgot to attach pic2 On Fri, Apr 15, 2011 at 11:34 AM, Hanneke van Dijk < Hanneke.vanDijk at med.uni-duesseldorf.de> wrote: > Dear Jan and Jan-Mathijs, > > Thanks for working on this problem! I'm testing it for data recorded with > the 'old' neuromag 122 system. I'm using the script that Jan attached to a > previous e-mail, and the fieldtrip version that was released yesterday. The > first question that I have is: > > What to do if you don't have fiducial information from the neuromag > software? I could use ft_volume_realign with cfg.method = 'interactive' and > point the fiducials out and swap the y and x axes. But in what coordinate > system am I then, and in what coordinate system should I move on? > > second, > > My 'vol' , headmodel, seems to end up in a factor 10 (or more(?)) smaller > unit then the grid and grad. You can't even see it in the headmodelplot (it > is a small dot somewhere in the middle). I don't know what happened there. > > third, > > If you look at the picture I attached the grid is not in the centre of the > helmet (pic1 from the top down), and very low (pic2 looking from the left). > I don't know how to solve that. I at least think the subject was not in the > helmet that way! > > Groetjes Hanneke > > -------------------------------------------------- > Dr. Hanneke van Dijk > Institut für Klinische Neurowissenschaften und Medizinische Psychologie > Gebäude-Nr.: 23.02 > Ebene: 03 Zimmer-Nr.: 47 > Tel.: +49 211-81-13074 > Mail : hanneke.vandijk at med.uni-duesseldorf.de > > http://www.uniklinik-duesseldorf.de/deutsch/unternehmen/institute/KlinNeurowiss/Team/HannekevanDijk/page.html > > > On Thu, Apr 14, 2011 at 9:31 AM, wrote: > >> Dear Jan-Mathijs, >> >> >> >> sure, I will do that. I have tested one head model with >> ft_dipole_simulation and beamforming and it looks good (at least when I >> simulate two conditions and subtract sources the right location comes out). >> So I guess we (and maybe others) will use the new procedure now. >> >> >> >> Best, >> >> jan >> >> >> ------------------------------ >> >> *Von:* fieldtrip-bounces at donders.ru.nl [mailto: >> fieldtrip-bounces at donders.ru.nl] *Im Auftrag von *jan-mathijs schoffelen >> *Gesendet:* Mittwoch, 13. April 2011 16:57 >> *An:* Email discussion list for the FieldTrip project >> *Betreff:* Re: [FieldTrip] I think you solved the problem >> >> >> >> Dear Jan, >> >> >> >> No problem. Thanks for the script. If you feel up to it, you are kindly >> invited to update the documentation on the fieldtrip wiki as well. If I >> recall correctly, at some point Hanneke added some documentation about how >> to create MNI-based dipole grids for neuromag data. A lot of the >> intermediate steps have now become obsolete and this part of the wiki can be >> substantially cleaned. >> >> >> >> Thanks, >> >> >> >> Jan-Mathijs >> >> >> >> >> >> On Apr 13, 2011, at 2:31 PM, < >> Jan.Hirschmann at med.uni-duesseldorf.de> wrote: >> >> >> >> Dear Jan-Mathijs, >> >> >> >> I think we solved the problem. Everthing is like you said in the first >> place. ft_volumerealign and ft_volumesegment should be called with >> cfg.coordsys=’neuromag’. The only thing that was wrong is that for the voxel >> coordinates read from the Neuromag GUI x and y should be swapped. For anyone >> interested I attach a script that is meant to be easy-to-use for beginners. >> >> >> >> Thank you very much for your time! >> ------------------------------ >> >> *Von:* fieldtrip-bounces at donders.ru.nl [ >> mailto:fieldtrip-bounces at donders.ru.nl ] >> *Im Auftrag von *jan-mathijs schoffelen >> *Gesendet:* Dienstag, 12. April 2011 21:18 >> *An:* Email discussion list for the FieldTrip project >> *Betreff:* Re: [FieldTrip] I think you solved the problem >> >> >> >> Dear Jan, >> >> >> >> I suspect that your mri, as it comes out of ft_read_mri is already >> coregistered in neuromag space. After your realignment and after replacing >> mri.transform with real_mri.transform, the coordinate axes in your pic1 look >> strange. This I think causes the 'dropped pocket change'. >> >> What happens if you skip the ft_volumerealign step and call >> ft_volumesegment directly on the mri (with cfg.coordsys = 'neuromag', or, >> for what it's worth, without cfg.coordsys; in this case you will be able to >> verify the coordinate system)? >> >> Alternatively, if this doesn't work, could you replace mri.transform by >> eye(4) prior to calling ft_volumerealign and ft_volumesegment (both with >> cfg.coordsys = 'neuromag' and no further tampering with transformation >> matrices?). >> >> >> >> Thanks >> >> >> >> JM >> >> >> >> >> >> On Apr 12, 2011, at 8:49 PM, < >> Jan.Hirschmann at med.uni-duesseldorf.de> wrote: >> >> >> >> >> Dear Jan-Mathijs, >> >> >> >> sorry, I think I was a bit too enthusiastic when I said everything worked >> out wonderfully. It worked only once. After an afternoon of confusion I >> concluded that on my first try I must have misspelled >> cfg.coordsys=’neuromag’ on my calls to ft_volumerealign and >> ft_volumesegment. In fact, the segmentation looks really bad with these >> settings. What works for me is written underneath: >> >> >> >> mri = ft_read_mri('….fif'); >> >> hdr=ft_read_header('…fif'); >> >> mri.anatomy=double(mri.anatomy); >> >> >> >> %this is taken from the Neuromag GUI for MRI-MEG Integration >> >> cfg=[]; >> >> cfg.fiducial.rpa=[136.35 142.80 31.96]; >> >> cfg.fiducial.nas=[47.84 101.80 100.10]; >> >> cfg.fiducial.lpa=[139.22 146.17 162.69]; >> >> >> >> %go from neuromag voxel to neuromag head coordinates >> >> cfg.coordsys='neuromag'; >> >> cfg.method='fiducial'; >> >> real_mri=ft_volumerealign(cfg,mri); >> >> >> >> %taking real_mri with its coordsys field will not work, so I take mri >> >> mri.transform=real_mri.transform; >> >> >> >> cfg = []; >> >> cfg.keepintermediate = 'no'; >> >> cfg.write = 'no'; >> >> segmentedmri = ft_volumesegment(cfg, mri); >> >> >> >> >> >> Before segmentation the function shows some kind of brain (pic 1). When >> segmentation is done the segmented brain looks good (pic 2) but the brain >> does not fit the helmet (pic 3). It is looking at its feet as if it dropped >> some pocket change. Do you know what is going on? >> >> >> >> Thanks, >> >> jan >> >> >> ------------------------------ >> >> *Von:* fieldtrip-bounces at donders.ru.nl [ >> mailto:fieldtrip-bounces at donders.ru.nl ] >> *Im Auftrag von *jan-mathijs schoffelen >> *Gesendet:* Dienstag, 12. April 2011 12:11 >> *An:* Email discussion list for the FieldTrip project >> *Betreff:* Re: [FieldTrip] I think you solved the problem >> >> >> >> Dear Jan, >> >> >> >> Apart from not being properly aligned, the segmentation looks a bit >> strange to me. I suspect that not everything went well here ;o). >> >> Could you try the following: >> >> >> >> specify cfg.coordsys = 'neuromag', both in your call to ft_volumerealign >> and in your call to ft_volumesegment. The cfg.coordinates for >> ft_volumesegment has to be removed (actually it is a deprecated option). The >> idea now is that mri-structures in fieldtrip can have a coordsys field, >> which allows for more transparent use of the different head coordinate >> system conventions. This takes away the need for intermediately >> coregistering the MRI in 'ctf'-convention, and would also take away your >> need to call headcoordinates later on. >> >> >> >> Best wishes, >> >> >> >> Jan-Mathijs >> >> >> >> >> >> On Apr 12, 2011, at 11:07 AM, < >> Jan.Hirschmann at med.uni-duesseldorf.de> wrote: >> >> >> >> >> >> Dear fieldtrip experts, >> >> >> >> I have two questions regarding head model creation. As noted on this >> thread, the volumesegment function was updated and I tested it for our >> Neuromag data. The segmentation is performed, but unfortunately it is not >> aligned with the MRI in my case. Here is the code I am using, the fieldtrip >> is from 9th April 2011. >> >> >> >> %read mri >> >> mri = ft_read_mri(subject_files.fiff_mri); >> >> mri.anatomy=double(mri.anatomy); >> >> >> >> %these are the fiducials for this subject taken from the Neuromag GUI for >> coregistration >> >> cfg=[]; >> >> cfg.fiducial.rpa=[136.35 142.80 31.96]; >> >> cfg.fiducial.nas=[47.84 101.80 100.10]; >> >> cfg.fiducial.lpa=[139.22 146.17 162.69]; >> >> >> >> %define the head coordinate system according to CTF conventions >> >> cfg.method='fiducial'; >> >> real_mri=ft_volumerealign(cfg,mri); >> >> >> >> %segment >> >> cfg = []; >> >> cfg.template = '/data/apps/spm/spm8/templates/T1.nii'; >> >> cfg.coordinates = 'ctf'; >> >> cfg.keepintermediate = 'no'; >> >> segmentedmri = ft_volumesegment(cfg, real_mri); >> >> >> >> %plot white matter >> >> test=segmentedmri; >> >> test.anatomy=real_mri.anatomy; >> >> cfg=[]; >> >> cfg.funparameter='white'; >> >> ft_sourceplot(cfg,test); %see attached picture >> >> >> >> The other issue regards back-transformation from CTF to Neuromag >> coordinates, which is necessary to make the head model fit the sensors. My >> idea was to create an appropriate transformation matrix like this. >> >> >> >> cd /net/avidya/storage/home/jan/fieldtrip-20110409/private >> >> ctfmat=headcoordinates(nas,lpa,rpa,'ctf'); >> >> nmmat=headcoordinates(nas,lpa,rpa,'neuromag'); >> >> ctf_to_nm=nmmat/ctfmat; >> >> >> >> >> >> And then to use it on the head model to bring it back into Neuromag >> coordinates: >> >> >> >> %create single shell, realistic headmodel >> >> cfg = []; >> >> hdm = ft_prepare_singleshell(cfg,segmentedmri); >> >> >> >> % transformation of headmodel into Neuromag space >> >> hdm.bnd.pnt=warp_apply(ctf_to_nm,hdm.bnd.pnt,'homogeneous'); >> >> >> >> Does this survive a sanity check? >> >> >> >> Best regards and thanks a lot, >> >> >> >> Jan >> >> >> >> >> ------------------------------ >> >> *Von:* fieldtrip-bounces at donders.ru.nl [ >> mailto:fieldtrip-bounces at donders.ru.nl ] >> *Im Auftrag von *Jen Whitman >> *Gesendet:* Montag, 28. Februar 2011 22:32 >> *An:* Email discussion list for the FieldTrip project >> *Betreff:* [FieldTrip] I think you solved the problem >> >> >> >> I just checked, and when I re-ran my segmentation script with the new >> Fieldtrip in order to use an spm8 template image, coordinates got reversed. >> When I take out the calls to flipdim, they look fine (see attached >> screenshots). That certainly explains the meaningless results I was getting! >> >> Thanks for figuring that out, >> >> Jen >> >> On Mon, Feb 28, 2011 at 12:36 PM, jan-mathijs schoffelen < >> jan.schoffelen at donders.ru.nl> wrote: >> >> Hi Jen, >> >> >> >> At first glance I have a comment on your script. You may need to >> explicitly check the alignment of your segmented volume and the original >> anatomy. A while a go some changes were made to ft_volumesegment, taking >> away the need to do the flipdim(flipdim... operations. I have posted this >> on the discussion list last January, but you may not have noticed. >> >> Anyway, if you now have used a recent version of FieldTrip for your >> segmentation both the location of your dipole grid, and the volume conductor >> model will not be adequately coregistered with the data, which may lead to >> funky results to begin with. That's most likely not related to the filetype >> in which the volumes are saved for later use. >> >> >> >> Best wishes, >> >> >> >> Jan-Mathijs >> >> >> >> >> >> >> >> On Feb 28, 2011, at 8:59 PM, Jen Whitman wrote: >> >> >> >> >> >> >> Hello Jan, >> >> When calling volumesegment, I specified 'ctf' as the coordinate system. >> The function I wrote to call volumesegment and prepare_singleshell for each >> subject and save the results is pasted below, with a couple of comments >> added for clarity. >> Over the weekend I tried specifying the coordinate system in the call to >> ft_volumenormalise as 'ctf' rather than 'spm', and commented out all the >> lines that said cfg.spmversion = 'spm8'; before calling a function. However, >> that created worse results, as each plot involved stripes of activation and >> empty voxels, suggesting that 'ctf' was not the correct coordinate system to >> specify. >> >> Thanks for the attached script. Looking in that the comments in that, I >> suspect that the solution to my problems will be to specify my filetype as >> nifti_img rather than nifti. I'll let you know how that goes. >> >> Jen >> >> >> ------------------------------------------------------------------------------------------------------------ >> % the variable subj is simply a string consisting of a subject number >> (e.g. 's05') which can be a folder name or part of a filename >> function [vol mri segmentedmri >> segmentedmriF]=call_volume_segment_function_spm8(subj) >> cfg.spmversion = 'spm8'; >> cfg.template = '/home/woodwardlab/spm8/templates/EPI.nii'; >> %cfg.template='/home/common/matlab/spm2/templates/T1.mnc'; >> cfg.name=[subj '_volseg']; >> cfg.write='yes'; >> cfg.smooth='no'; >> cfg.coordinates='ctf'; >> mri=read_mri([subj '/mri/' subj 'head.mri']); % made with CTF mriConverter >> and mriViewer software, after fiducials were marked >> segmentedmri = volumesegment(cfg, mri); >> segmentedmriF = segmentedmri; >> segmentedmriF.gray = flipdim(flipdim(flipdim(segmentedmriF.gray,3),2),1); >> segmentedmriF.white = >> flipdim(flipdim(flipdim(segmentedmriF.white,3),2),1); >> segmentedmriF.csf = flipdim(flipdim(flipdim(segmentedmriF.csf,3),2),1); >> segmentedmriF.transform = mri.transform; >> segmentedmriF.anatomy = mri.anatomy; >> cfg = []; >> cfg.spmversion = 'spm8'; >> vol = prepare_singleshell(cfg, segmentedmriF); >> eval(['save ' subj '/meg/mrisegmented.mat mri segmentedmri segmentedmriF >> vol']) >> >> >> >> >> >> On Sat, Feb 26, 2011 at 5:26 AM, jan-mathijs schoffelen < >> jan.schoffelen at donders.ru.nl> wrote: >> >> Dear Jen, >> >> >> >> I do not manage to reproduce your issue, when only focussing on the >> ft_volumewrite and visualization part of your pipeline. See attached script, >> and yet an updated version of ft_volumewrite which you need to (hopefully) >> draw the same conclusion as I did. >> >> Yet, I only now realize that your question may pertain to the entire >> pipeline. It could be that something is going wrong there. >> >> I only see now that in the part of your script of which you reported that >> it gave 'good' results, you specify cfg.coordinates = 'ctf' before calling >> ft_volumenormalise. I assume this is correct, because the coordinate system >> your source-reconstructed data lives in, is according to the CTF-convention, >> and not according to the SPM-convention. On the other hand, the template for >> the spatial normalization lives in the SPM-coordinate system. In order for >> the spatial normalization to work OK, Fieldtrip tries to convert from one >> coordinate system to the other (once again, this is appropriate behaviour), >> before doing the actual normalization. It seems that at least in the script >> you sent along, in the final (not working version), you specified >> cfg.coordinates = 'spm' prior to calling ft_volumenormalise. This is >> probably wrong. >> >> Another important point that should be mentioned, is that the coordinate >> systems in which the functional data and the anatomical data live should be >> the same for the ft_sourceinterpolate to make sense. In other words, if your >> source reconstructed images are defined on a 3D grid of positions in >> CTF-space, the mri.transform of your anatomy should describe a >> transformation from voxel to CTF-space. >> >> I think you may want to revisit step by step this part of the pipeline; I >> don't think the problem lies in the writing. >> >> A final possibility of course is that Mricron is misbehaving... >> >> >> >> Best, >> >> >> >> Jan-Mathijs >> >> >> >> >> >> >> >> >> >> >> >> >> >> On Feb 25, 2011, at 9:44 PM, Jen Whitman wrote: >> >> >> >> >> >> >> Hi Jan, >> >> I tried re-running the analysis with the new script you sent me, and the >> latest version of fieldtrip (since I needed ft_get_opt as well), but the >> spm8 images being written are still producing flawed results. It's the same >> problem as I mentioned briefly in my previous post. I am not getting any >> error messages when writing these images. Rather, my problem is that the >> spm8 and spm2 results from the same data ought to be identical when viewed >> in mricron, but they're far from it. When I use mricron to look at the >> results from the spm8-format images, combined across participants to create >> a t-image, I just get a single 'blob' spanning roughly half the brain. In >> contrast, when I used spm2-format previously on the same data, the t-image >> was much more meaningful; a posterior alpha power decrease in a set of >> regions corresponding to the 'task-positive network' (a network found in the >> results of an fMRI version of my experiment, and widely reported in the fMRI >> literature). >> >> This failure to replicate the spm2 results when using spm8 images from the >> same data leads me to suspect that something is wrong with the coordinates >> for spm8 format. However, after experimenting extensively with different cfg >> options I still haven't identified the problem. If I my structural MRIs have >> been saved to .mri files using CTF's MRIConverter program, which cfg >> options, particularly for coordinates, template images, and filetypes, >> should I specify before calling the ft_volumesegment, >> ft_prepare_singleshell, ft_sourceinterpolate, ft_volumenormalise, and >> ft_volumewrite functions? Or should I be calling a different set of >> functions now? >> >> Thanks again for your help, >> >> Jen >> >> On Thu, Feb 24, 2011 at 10:07 AM, Jen Whitman >> wrote: >> >> Great, thanks! >> >> I'll start the analysis with your new script today and will let you know >> how it works out. >> >> Jen >> >> On Thu, Feb 24, 2011 at 4:44 AM, jan-mathijs schoffelen < >> jan.schoffelen at donders.ru.nl> wrote: >> >> Dear Jen, >> >> >> >> I managed to reproduce your problem. The code was rather buggy and indeed >> ft_volumewrite did not behave as it should have. I now fixed it in the code >> and it should run fine now. Please find the updated file attached. It will >> be available on our ftp-server as of tonight. Please note that I updated the >> documentation, and changed the names of some of the options a bit. If you >> want to save your data in analyze-format, you should specify cfg.filetype = >> 'analyze_spm'. If you specify cfg.filetype = 'nifti', it should write out a >> volume to nifti-format, using SPM8. >> >> >> >> Best wishes, >> >> >> >> Jan-Mathijs >> >> >> >> >> >> >> >> >> >> >> >> On Feb 23, 2011, at 7:44 PM, Jen Whitman wrote: >> >> >> >> >> Dear Jan, >> >> Thanks for the quick reply. Yes, I have tried it out quite a few times >> now, experimenting with different settings in the cfgs. Below I'll paste the >> code I've been using to write images - first the code that successfully >> created spm2 images that produced good results, then the code used for >> creating nifti format images from the same data. The comments in this second >> part are at this point a bit of a maze of cfg options I've been changing >> back & forth. Any insights/suggestions regarding how to set up my cfgs to >> make this work would be greatly appreciated. >> >> Jen >> >> >> %%%%%%%% this code generated spm2-compatible images which did work >> (producing results that made sense). >> >> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% >> >> sourcetemp.avg.pow = (sourcetemp.avg.pow - sourcePre.avg.pow) ./ >> sourcePre.avg.pow; >> >> cfg = []; >> cfg.downsample = 2; >> sourcetempInt = sourceinterpolate(cfg, sourcetemp , mri); >> >> % projecting the plot onto a surface... >> cfg = []; >> cfg.coordinates = 'ctf'; >> cfg.template = '/home/common/matlab/spm2/templates/T1.mnc'; %this >> template is in MNI coordinates >> sourcetempIntN = volumenormalise(cfg, sourcetempInt); >> >> filename=[subj 'run' int2str(r) 'cond' int2str(cond) '_' int2str(f) >> 'HzWin' int2str(win) 'width750ms']; >> cfg=[]; >> cfg.parameter = 'avg.pow'; % string, describing the functional >> data to be processed, e.g. 'pow', 'coh' or 'nai' >> cfg.filename = [filename '.img']; %'testimageoutput_alphafreq'; % >> filename without the extension >> cfg.filetype = 'spm'; %'analyze', 'spm', 'vmp' or 'vmr' >> cfg.coordinates = 'spm'; %'spm, 'ctf' or empty for interactive >> (default = []) >> cfg.datatype = 'double'; %'float'; %'double'; %'bit1', 'uint8', >> 'int16', 'int32', 'float' or 'double' >> >> volumewrite(cfg, sourcetempIntN) >> >> >> >> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% >> >> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% >> >> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% >> >> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% >> %%%%% this code below hasn't worked yet... >> >> % I added cfg.spmversion = 'spm8'; >> % in the cfgs for the calls to ft_prepare_leadfield and ft_sourceanalysis, >> % and in the call to prepare_singleshell after calling volumesegment >> >> % I've also ensured that spm8 is the only spm version in my path, even in >> % the fieldtrip/external folder, and ensured that spm8 is installed >> properly >> % (files compiled correctly, etc..) >> >> sourcetemp.avg.pow = (sourcetemp.avg.pow - sourcePre.avg.pow) ./ >> sourcePre.avg.pow; >> >> filename=[subj 'run' int2str(r) 'cond' int2str(cond) '_' int2str(f) >> 'Hzspm8_FIXv9_Win' int2str(win) 'width750ms.img']; >> >> cfg = []; >> % cfg.coordinates = 'spm'; % changed for version 5 >> % cfg.spmversion = 'spm8'; % changed for version 5 >> cfg.downsample = 4; >> sourcetempInt = ft_sourceinterpolate(cfg, sourcetemp , mri); >> >> >> % projecting the plot onto a surface... >> cfg = []; >> %cfg.coordinates = 'spm'; % changed for version 5 >> %cfg.coordinates = 'ctf'; % changed for version 5 >> cfg.coordinates = 'spm'; % changed back to spm for version 9 >> cfg.downsample = 4; >> %cfg.spmversion = 'spm8'; % changed for version 6 (because this gets >> specified in volumewrite) >> cfg.template = 'Hmatrix/mask.nii.nii'; % basically equivalent to using >> spm8/templates/EPI.nii, except that mask.nii (produced from fmri data) has >> the desired voxel size >> % cfg.name = [filename]; % changed for version 6 >> %cfg.write= 'yes'; % changed for version 6 (when this was set to 'yes' >> there was no subsequent call to volumewrite) >> cfg.write= 'no'; % changed for version 6 >> sourcetempIntN = ft_volumenormalise(cfg, sourcetempInt); >> >> % this whole cfg and function call added for version 6 >> cfg=[]; >> % cfg.parameter = string, describing the functional data to be >> processed, e.g. 'pow', 'coh' or 'nai' >> % cfg.filename = filename without the extension >> % cfg.filetype = 'analyze', 'spm', 'vmp' or 'vmr' >> % cfg.vmpversion = 1 or 2 (default) version of the vmp-format to use >> % cfg.coordinates = 'spm, 'ctf' or empty for interactive (default = >> []) >> cfg.parameter='pow'; >> cfg.filename=filename; >> cfg.filetype = 'spm'; >> cfg.spmversion = 'SPM8'; % capitalized after first error message from >> vers 6 >> % cfg.dataformat='nifti'; % added after first error message from vers 6 >> % commented out after 2nd error message >> from vers 6 >> %cfg.vmpversion=2; % this is a filetype, like spm, so don't need to >> specify unless cfg.filetyp='vmp' >> cfg.coordinates='spm'; >> ft_volumewrite(cfg,sourcetempIntN); >> >> >> >> >> >> >> >> On Wed, Feb 23, 2011 at 7:50 AM, jan-mathijs schoffelen < >> jan.schoffelen at donders.ru.nl> wrote: >> >> Dear Jen, >> >> I notice that indeed in the documentation section of ft_write_volume there >> is a FIXME behind nifti. Yet, nifti format seems to be supported by >> ft_write_volume (at least in a recent version of fieldtrip). Did you try it >> at all (and ran into problems) or were you held back by the FIXME statement? >> Could you just try it out using a recent fieldtrip function? >> >> Thanks and best wishes >> >> Jan-Mathijs >> >> >> >> >> On Feb 23, 2011, at 2:21 AM, Jen Whitman wrote: >> >> Hello, >> >> While writing beamformed images to spm2 format in a previous version of >> fieldtrip (now lost due to a computer crash), I was able to get nice-looking >> results; networks of brain regions consistent with existing literature. When >> I try to write images from the same dataset and the same analysis to spm8 >> format, my results (t-images computed across subjects) end up being single >> clusters spanning large sections of the brain (e.g. a 'blob' spanning all of >> one hemisphere but not the other). Unfortunately, some aspects of my planned >> data analyses cannot be performed on spm2 images, so I have to find a way of >> writing to successfully to nifti format. >> >> I just noticed that in the comments in the ft_write_volume function, which >> I am calling via ft_volumewrite, it says 'FIXME' next to nifti under the >> list of supported dataformats. Is there by any chance a patch out there for >> writing nifti images? >> >> Thanks! >> >> _______________________________________________ >> fieldtrip mailing list >> fieldtrip at donders.ru.nl >> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip >> >> >> Dr. J.M. (Jan-Mathijs) Schoffelen >> Donders Institute for Brain, Cognition and Behaviour, >> Centre for Cognitive Neuroimaging, >> Radboud University Nijmegen, The Netherlands >> J.Schoffelen at donders.ru.nl >> Telephone: 0031-24-3614793 >> >> _______________________________________________ >> fieldtrip mailing list >> fieldtrip at donders.ru.nl >> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip >> >> >> _______________________________________________ >> fieldtrip mailing list >> fieldtrip at donders.ru.nl >> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip >> >> >> >> Dr. J.M. (Jan-Mathijs) Schoffelen >> >> Donders Institute for Brain, Cognition and Behaviour, >> Centre for Cognitive Neuroimaging, >> Radboud University Nijmegen, The Netherlands >> >> J.Schoffelen at donders.ru.nl >> >> Telephone: 0031-24-3614793 >> >> >> >> >> _______________________________________________ >> fieldtrip mailing list >> fieldtrip at donders.ru.nl >> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip >> >> >> >> >> _______________________________________________ >> fieldtrip mailing list >> fieldtrip at donders.ru.nl >> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip >> >> >> >> Dr. J.M. (Jan-Mathijs) Schoffelen >> >> Donders Institute for Brain, Cognition and Behaviour, >> Centre for Cognitive Neuroimaging, >> Radboud University Nijmegen, The Netherlands >> >> J.Schoffelen at donders.ru.nl >> >> Telephone: 0031-24-3614793 >> >> >> >> >> _______________________________________________ >> fieldtrip mailing list >> fieldtrip at donders.ru.nl >> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip >> >> >> _______________________________________________ >> fieldtrip mailing list >> fieldtrip at donders.ru.nl >> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip >> >> >> >> Dr. J.M. (Jan-Mathijs) Schoffelen >> >> Donders Institute for Brain, Cognition and Behaviour, >> Centre for Cognitive Neuroimaging, >> Radboud University Nijmegen, The Netherlands >> >> J.Schoffelen at donders.ru.nl >> >> Telephone: 0031-24-3614793 >> >> >> >> >> _______________________________________________ >> fieldtrip mailing list >> fieldtrip at donders.ru.nl >> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip >> >> >> >> >> >> _______________________________________________ >> fieldtrip mailing list >> fieldtrip at donders.ru.nl >> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip >> >> >> >> Dr. J.M. (Jan-Mathijs) Schoffelen >> >> Donders Institute for Brain, Cognition and Behaviour, >> Centre for Cognitive Neuroimaging, >> Radboud University Nijmegen, The Netherlands >> >> J.Schoffelen at donders.ru.nl >> >> Telephone: 0031-24-3614793 >> >> >> >> >> >> _______________________________________________ >> fieldtrip mailing list >> fieldtrip at donders.ru.nl >> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip >> >> >> >> Dr. J.M. (Jan-Mathijs) Schoffelen >> >> Donders Institute for Brain, Cognition and Behaviour, >> Centre for Cognitive Neuroimaging, >> Radboud University Nijmegen, The Netherlands >> >> J.Schoffelen at donders.ru.nl >> >> Telephone: 0031-24-3614793 >> >> >> >> >> >> _______________________________________________ >> fieldtrip mailing list >> fieldtrip at donders.ru.nl >> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip >> >> >> >> Dr. J.M. (Jan-Mathijs) Schoffelen >> >> Donders Institute for Brain, Cognition and Behaviour, >> Centre for Cognitive Neuroimaging, >> Radboud University Nijmegen, The Netherlands >> >> J.Schoffelen at donders.ru.nl >> >> Telephone: 0031-24-3614793 >> >> >> >> _______________________________________________ >> fieldtrip mailing list >> fieldtrip at donders.ru.nl >> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip >> > > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: pic2.jpg Type: image/jpeg Size: 19281 bytes Desc: not available URL: From Jan.Hirschmann at med.uni-duesseldorf.de Fri Apr 15 13:29:46 2011 From: Jan.Hirschmann at med.uni-duesseldorf.de (Jan.Hirschmann at med.uni-duesseldorf.de) Date: Fri, 15 Apr 2011 13:29:46 +0200 Subject: [FieldTrip] I think you solved the problem In-Reply-To: References: <72E993C35FB11743B79FF9286E5B6D8B02676142@Mail2-UKD.VMED.UKD><7B5CA863-D143-404C-BCB9-805AA6E6E546@donders.ru.nl><72E993C35FB11743B79FF9286E5B6D8B02676264@Mail2-UKD.VMED.UKD><72E993C35FB11743B79FF9286E5B6D8B026763B8@Mail2-UKD.VMED.UKD><5AC469DB-D5B1-4E3C-AE21-01A53AE94A26@donders.ru.nl><72E993C35FB11743B79FF9286E5B6D8B02676493@Mail2-UKD.VMED.UKD> Message-ID: <72E993C35FB11743B79FF9286E5B6D8B026766A9@Mail2-UKD.VMED.UKD> Hi Hanneke, it occured to me to change x and y when I clicked around in the mri presented to me by vt_voulmesegment (it shows up when cfg.coordsys is not specified). I noticed that a voxel that had index [i j k] in the neuromag GUI had index [j i k] in this image. But when you specify the fiducials manually in fieldtrip, I don't think you have to worry about that. You could try not to swap x and y coordinates and comment out cfg.coordsys in the segmentation part. In the picture that comes up, do the axes go through the fiducials (y through nas)? If so, the alignment is correct. To my mind, the big helmet in your picture could mean that the sensor positions are given in cm and the headmodel vertices in m. What happens if you multiply headmodel.pos by 10? Best, jan ________________________________ Von: fieldtrip-bounces at donders.ru.nl [mailto:fieldtrip-bounces at donders.ru.nl] Im Auftrag von Hanneke van Dijk Gesendet: Freitag, 15. April 2011 11:34 An: Email discussion list for the FieldTrip project Betreff: Re: [FieldTrip] I think you solved the problem Dear Jan and Jan-Mathijs, Thanks for working on this problem! I'm testing it for data recorded with the 'old' neuromag 122 system. I'm using the script that Jan attached to a previous e-mail, and the fieldtrip version that was released yesterday. The first question that I have is: What to do if you don't have fiducial information from the neuromag software? I could use ft_volume_realign with cfg.method = 'interactive' and point the fiducials out and swap the y and x axes. But in what coordinate system am I then, and in what coordinate system should I move on? second, My 'vol' , headmodel, seems to end up in a factor 10 (or more(?)) smaller unit then the grid and grad. You can't even see it in the headmodelplot (it is a small dot somewhere in the middle). I don't know what happened there. third, If you look at the picture I attached the grid is not in the centre of the helmet (pic1 from the top down), and very low (pic2 looking from the left). I don't know how to solve that. I at least think the subject was not in the helmet that way! Groetjes Hanneke -------------------------------------------------- Dr. Hanneke van Dijk Institut für Klinische Neurowissenschaften und Medizinische Psychologie Gebäude-Nr.: 23.02 Ebene: 03 Zimmer-Nr.: 47 Tel.: +49 211-81-13074 Mail : hanneke.vandijk at med.uni-duesseldorf.de http://www.uniklinik-duesseldorf.de/deutsch/unternehmen/institute/KlinNeurowiss/Team/HannekevanDijk/page.html On Thu, Apr 14, 2011 at 9:31 AM, wrote: Dear Jan-Mathijs, sure, I will do that. I have tested one head model with ft_dipole_simulation and beamforming and it looks good (at least when I simulate two conditions and subtract sources the right location comes out). So I guess we (and maybe others) will use the new procedure now. Best, jan ________________________________ Von: fieldtrip-bounces at donders.ru.nl [mailto:fieldtrip-bounces at donders.ru.nl] Im Auftrag von jan-mathijs schoffelen Gesendet: Mittwoch, 13. April 2011 16:57 An: Email discussion list for the FieldTrip project Betreff: Re: [FieldTrip] I think you solved the problem Dear Jan, No problem. Thanks for the script. If you feel up to it, you are kindly invited to update the documentation on the fieldtrip wiki as well. If I recall correctly, at some point Hanneke added some documentation about how to create MNI-based dipole grids for neuromag data. A lot of the intermediate steps have now become obsolete and this part of the wiki can be substantially cleaned. Thanks, Jan-Mathijs On Apr 13, 2011, at 2:31 PM, wrote: Dear Jan-Mathijs, I think we solved the problem. Everthing is like you said in the first place. ft_volumerealign and ft_volumesegment should be called with cfg.coordsys='neuromag'. The only thing that was wrong is that for the voxel coordinates read from the Neuromag GUI x and y should be swapped. For anyone interested I attach a script that is meant to be easy-to-use for beginners. Thank you very much for your time! ________________________________ Von: fieldtrip-bounces at donders.ru.nl [mailto:fieldtrip-bounces at donders.ru.nl] Im Auftrag von jan-mathijs schoffelen Gesendet: Dienstag, 12. April 2011 21:18 An: Email discussion list for the FieldTrip project Betreff: Re: [FieldTrip] I think you solved the problem Dear Jan, I suspect that your mri, as it comes out of ft_read_mri is already coregistered in neuromag space. After your realignment and after replacing mri.transform with real_mri.transform, the coordinate axes in your pic1 look strange. This I think causes the 'dropped pocket change'. What happens if you skip the ft_volumerealign step and call ft_volumesegment directly on the mri (with cfg.coordsys = 'neuromag', or, for what it's worth, without cfg.coordsys; in this case you will be able to verify the coordinate system)? Alternatively, if this doesn't work, could you replace mri.transform by eye(4) prior to calling ft_volumerealign and ft_volumesegment (both with cfg.coordsys = 'neuromag' and no further tampering with transformation matrices?). Thanks JM On Apr 12, 2011, at 8:49 PM, wrote: Dear Jan-Mathijs, sorry, I think I was a bit too enthusiastic when I said everything worked out wonderfully. It worked only once. After an afternoon of confusion I concluded that on my first try I must have misspelled cfg.coordsys='neuromag' on my calls to ft_volumerealign and ft_volumesegment. In fact, the segmentation looks really bad with these settings. What works for me is written underneath: mri = ft_read_mri('....fif'); hdr=ft_read_header('...fif'); mri.anatomy=double(mri.anatomy); %this is taken from the Neuromag GUI for MRI-MEG Integration cfg=[]; cfg.fiducial.rpa=[136.35 142.80 31.96]; cfg.fiducial.nas=[47.84 101.80 100.10]; cfg.fiducial.lpa=[139.22 146.17 162.69]; %go from neuromag voxel to neuromag head coordinates cfg.coordsys='neuromag'; cfg.method='fiducial'; real_mri=ft_volumerealign(cfg,mri); %taking real_mri with its coordsys field will not work, so I take mri mri.transform=real_mri.transform; cfg = []; cfg.keepintermediate = 'no'; cfg.write = 'no'; segmentedmri = ft_volumesegment(cfg, mri); Before segmentation the function shows some kind of brain (pic 1). When segmentation is done the segmented brain looks good (pic 2) but the brain does not fit the helmet (pic 3). It is looking at its feet as if it dropped some pocket change. Do you know what is going on? Thanks, jan ________________________________ Von: fieldtrip-bounces at donders.ru.nl [mailto:fieldtrip-bounces at donders.ru.nl] Im Auftrag von jan-mathijs schoffelen Gesendet: Dienstag, 12. April 2011 12:11 An: Email discussion list for the FieldTrip project Betreff: Re: [FieldTrip] I think you solved the problem Dear Jan, Apart from not being properly aligned, the segmentation looks a bit strange to me. I suspect that not everything went well here ;o). Could you try the following: specify cfg.coordsys = 'neuromag', both in your call to ft_volumerealign and in your call to ft_volumesegment. The cfg.coordinates for ft_volumesegment has to be removed (actually it is a deprecated option). The idea now is that mri-structures in fieldtrip can have a coordsys field, which allows for more transparent use of the different head coordinate system conventions. This takes away the need for intermediately coregistering the MRI in 'ctf'-convention, and would also take away your need to call headcoordinates later on. Best wishes, Jan-Mathijs On Apr 12, 2011, at 11:07 AM, wrote: Dear fieldtrip experts, I have two questions regarding head model creation. As noted on this thread, the volumesegment function was updated and I tested it for our Neuromag data. The segmentation is performed, but unfortunately it is not aligned with the MRI in my case. Here is the code I am using, the fieldtrip is from 9th April 2011. %read mri mri = ft_read_mri(subject_files.fiff_mri); mri.anatomy=double(mri.anatomy); %these are the fiducials for this subject taken from the Neuromag GUI for coregistration cfg=[]; cfg.fiducial.rpa=[136.35 142.80 31.96]; cfg.fiducial.nas=[47.84 101.80 100.10]; cfg.fiducial.lpa=[139.22 146.17 162.69]; %define the head coordinate system according to CTF conventions cfg.method='fiducial'; real_mri=ft_volumerealign(cfg,mri); %segment cfg = []; cfg.template = '/data/apps/spm/spm8/templates/T1.nii'; cfg.coordinates = 'ctf'; cfg.keepintermediate = 'no'; segmentedmri = ft_volumesegment(cfg, real_mri); %plot white matter test=segmentedmri; test.anatomy=real_mri.anatomy; cfg=[]; cfg.funparameter='white'; ft_sourceplot(cfg,test); %see attached picture The other issue regards back-transformation from CTF to Neuromag coordinates, which is necessary to make the head model fit the sensors. My idea was to create an appropriate transformation matrix like this. cd /net/avidya/storage/home/jan/fieldtrip-20110409/private ctfmat=headcoordinates(nas,lpa,rpa,'ctf'); nmmat=headcoordinates(nas,lpa,rpa,'neuromag'); ctf_to_nm=nmmat/ctfmat; And then to use it on the head model to bring it back into Neuromag coordinates: %create single shell, realistic headmodel cfg = []; hdm = ft_prepare_singleshell(cfg,segmentedmri); % transformation of headmodel into Neuromag space hdm.bnd.pnt=warp_apply(ctf_to_nm,hdm.bnd.pnt,'homogeneous'); Does this survive a sanity check? Best regards and thanks a lot, Jan ________________________________ Von: fieldtrip-bounces at donders.ru.nl [mailto:fieldtrip-bounces at donders.ru.nl] Im Auftrag von Jen Whitman Gesendet: Montag, 28. Februar 2011 22:32 An: Email discussion list for the FieldTrip project Betreff: [FieldTrip] I think you solved the problem I just checked, and when I re-ran my segmentation script with the new Fieldtrip in order to use an spm8 template image, coordinates got reversed. When I take out the calls to flipdim, they look fine (see attached screenshots). That certainly explains the meaningless results I was getting! Thanks for figuring that out, Jen On Mon, Feb 28, 2011 at 12:36 PM, jan-mathijs schoffelen wrote: Hi Jen, At first glance I have a comment on your script. You may need to explicitly check the alignment of your segmented volume and the original anatomy. A while a go some changes were made to ft_volumesegment, taking away the need to do the flipdim(flipdim... operations. I have posted this on the discussion list last January, but you may not have noticed. Anyway, if you now have used a recent version of FieldTrip for your segmentation both the location of your dipole grid, and the volume conductor model will not be adequately coregistered with the data, which may lead to funky results to begin with. That's most likely not related to the filetype in which the volumes are saved for later use. Best wishes, Jan-Mathijs On Feb 28, 2011, at 8:59 PM, Jen Whitman wrote: Hello Jan, When calling volumesegment, I specified 'ctf' as the coordinate system. The function I wrote to call volumesegment and prepare_singleshell for each subject and save the results is pasted below, with a couple of comments added for clarity. Over the weekend I tried specifying the coordinate system in the call to ft_volumenormalise as 'ctf' rather than 'spm', and commented out all the lines that said cfg.spmversion = 'spm8'; before calling a function. However, that created worse results, as each plot involved stripes of activation and empty voxels, suggesting that 'ctf' was not the correct coordinate system to specify. Thanks for the attached script. Looking in that the comments in that, I suspect that the solution to my problems will be to specify my filetype as nifti_img rather than nifti. I'll let you know how that goes. Jen ------------------------------------------------------------------------------------------------------------ % the variable subj is simply a string consisting of a subject number (e.g. 's05') which can be a folder name or part of a filename function [vol mri segmentedmri segmentedmriF]=call_volume_segment_function_spm8(subj) cfg.spmversion = 'spm8'; cfg.template = '/home/woodwardlab/spm8/templates/EPI.nii'; %cfg.template='/home/common/matlab/spm2/templates/T1.mnc'; cfg.name=[subj '_volseg']; cfg.write='yes'; cfg.smooth='no'; cfg.coordinates='ctf'; mri=read_mri([subj '/mri/' subj 'head.mri']); % made with CTF mriConverter and mriViewer software, after fiducials were marked segmentedmri = volumesegment(cfg, mri); segmentedmriF = segmentedmri; segmentedmriF.gray = flipdim(flipdim(flipdim(segmentedmriF.gray,3),2),1); segmentedmriF.white = flipdim(flipdim(flipdim(segmentedmriF.white,3),2),1); segmentedmriF.csf = flipdim(flipdim(flipdim(segmentedmriF.csf,3),2),1); segmentedmriF.transform = mri.transform; segmentedmriF.anatomy = mri.anatomy; cfg = []; cfg.spmversion = 'spm8'; vol = prepare_singleshell(cfg, segmentedmriF); eval(['save ' subj '/meg/mrisegmented.mat mri segmentedmri segmentedmriF vol']) On Sat, Feb 26, 2011 at 5:26 AM, jan-mathijs schoffelen wrote: Dear Jen, I do not manage to reproduce your issue, when only focussing on the ft_volumewrite and visualization part of your pipeline. See attached script, and yet an updated version of ft_volumewrite which you need to (hopefully) draw the same conclusion as I did. Yet, I only now realize that your question may pertain to the entire pipeline. It could be that something is going wrong there. I only see now that in the part of your script of which you reported that it gave 'good' results, you specify cfg.coordinates = 'ctf' before calling ft_volumenormalise. I assume this is correct, because the coordinate system your source-reconstructed data lives in, is according to the CTF-convention, and not according to the SPM-convention. On the other hand, the template for the spatial normalization lives in the SPM-coordinate system. In order for the spatial normalization to work OK, Fieldtrip tries to convert from one coordinate system to the other (once again, this is appropriate behaviour), before doing the actual normalization. It seems that at least in the script you sent along, in the final (not working version), you specified cfg.coordinates = 'spm' prior to calling ft_volumenormalise. This is probably wrong. Another important point that should be mentioned, is that the coordinate systems in which the functional data and the anatomical data live should be the same for the ft_sourceinterpolate to make sense. In other words, if your source reconstructed images are defined on a 3D grid of positions in CTF-space, the mri.transform of your anatomy should describe a transformation from voxel to CTF-space. I think you may want to revisit step by step this part of the pipeline; I don't think the problem lies in the writing. A final possibility of course is that Mricron is misbehaving... Best, Jan-Mathijs On Feb 25, 2011, at 9:44 PM, Jen Whitman wrote: Hi Jan, I tried re-running the analysis with the new script you sent me, and the latest version of fieldtrip (since I needed ft_get_opt as well), but the spm8 images being written are still producing flawed results. It's the same problem as I mentioned briefly in my previous post. I am not getting any error messages when writing these images. Rather, my problem is that the spm8 and spm2 results from the same data ought to be identical when viewed in mricron, but they're far from it. When I use mricron to look at the results from the spm8-format images, combined across participants to create a t-image, I just get a single 'blob' spanning roughly half the brain. In contrast, when I used spm2-format previously on the same data, the t-image was much more meaningful; a posterior alpha power decrease in a set of regions corresponding to the 'task-positive network' (a network found in the results of an fMRI version of my experiment, and widely reported in the fMRI literature). This failure to replicate the spm2 results when using spm8 images from the same data leads me to suspect that something is wrong with the coordinates for spm8 format. However, after experimenting extensively with different cfg options I still haven't identified the problem. If I my structural MRIs have been saved to .mri files using CTF's MRIConverter program, which cfg options, particularly for coordinates, template images, and filetypes, should I specify before calling the ft_volumesegment, ft_prepare_singleshell, ft_sourceinterpolate, ft_volumenormalise, and ft_volumewrite functions? Or should I be calling a different set of functions now? Thanks again for your help, Jen On Thu, Feb 24, 2011 at 10:07 AM, Jen Whitman wrote: Great, thanks! I'll start the analysis with your new script today and will let you know how it works out. Jen On Thu, Feb 24, 2011 at 4:44 AM, jan-mathijs schoffelen wrote: Dear Jen, I managed to reproduce your problem. The code was rather buggy and indeed ft_volumewrite did not behave as it should have. I now fixed it in the code and it should run fine now. Please find the updated file attached. It will be available on our ftp-server as of tonight. Please note that I updated the documentation, and changed the names of some of the options a bit. If you want to save your data in analyze-format, you should specify cfg.filetype = 'analyze_spm'. If you specify cfg.filetype = 'nifti', it should write out a volume to nifti-format, using SPM8. Best wishes, Jan-Mathijs On Feb 23, 2011, at 7:44 PM, Jen Whitman wrote: Dear Jan, Thanks for the quick reply. Yes, I have tried it out quite a few times now, experimenting with different settings in the cfgs. Below I'll paste the code I've been using to write images - first the code that successfully created spm2 images that produced good results, then the code used for creating nifti format images from the same data. The comments in this second part are at this point a bit of a maze of cfg options I've been changing back & forth. Any insights/suggestions regarding how to set up my cfgs to make this work would be greatly appreciated. Jen %%%%%%%% this code generated spm2-compatible images which did work (producing results that made sense). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% sourcetemp.avg.pow = (sourcetemp.avg.pow - sourcePre.avg.pow) ./ sourcePre.avg.pow; cfg = []; cfg.downsample = 2; sourcetempInt = sourceinterpolate(cfg, sourcetemp , mri); % projecting the plot onto a surface... cfg = []; cfg.coordinates = 'ctf'; cfg.template = '/home/common/matlab/spm2/templates/T1.mnc'; %this template is in MNI coordinates sourcetempIntN = volumenormalise(cfg, sourcetempInt); filename=[subj 'run' int2str(r) 'cond' int2str(cond) '_' int2str(f) 'HzWin' int2str(win) 'width750ms']; cfg=[]; cfg.parameter = 'avg.pow'; % string, describing the functional data to be processed, e.g. 'pow', 'coh' or 'nai' cfg.filename = [filename '.img']; %'testimageoutput_alphafreq'; % filename without the extension cfg.filetype = 'spm'; %'analyze', 'spm', 'vmp' or 'vmr' cfg.coordinates = 'spm'; %'spm, 'ctf' or empty for interactive (default = []) cfg.datatype = 'double'; %'float'; %'double'; %'bit1', 'uint8', 'int16', 'int32', 'float' or 'double' volumewrite(cfg, sourcetempIntN) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%% this code below hasn't worked yet... % I added cfg.spmversion = 'spm8'; % in the cfgs for the calls to ft_prepare_leadfield and ft_sourceanalysis, % and in the call to prepare_singleshell after calling volumesegment % I've also ensured that spm8 is the only spm version in my path, even in % the fieldtrip/external folder, and ensured that spm8 is installed properly % (files compiled correctly, etc..) sourcetemp.avg.pow = (sourcetemp.avg.pow - sourcePre.avg.pow) ./ sourcePre.avg.pow; filename=[subj 'run' int2str(r) 'cond' int2str(cond) '_' int2str(f) 'Hzspm8_FIXv9_Win' int2str(win) 'width750ms.img']; cfg = []; % cfg.coordinates = 'spm'; % changed for version 5 % cfg.spmversion = 'spm8'; % changed for version 5 cfg.downsample = 4; sourcetempInt = ft_sourceinterpolate(cfg, sourcetemp , mri); % projecting the plot onto a surface... cfg = []; %cfg.coordinates = 'spm'; % changed for version 5 %cfg.coordinates = 'ctf'; % changed for version 5 cfg.coordinates = 'spm'; % changed back to spm for version 9 cfg.downsample = 4; %cfg.spmversion = 'spm8'; % changed for version 6 (because this gets specified in volumewrite) cfg.template = 'Hmatrix/mask.nii.nii'; % basically equivalent to using spm8/templates/EPI.nii, except that mask.nii (produced from fmri data) has the desired voxel size % cfg.name = [filename]; % changed for version 6 %cfg.write= 'yes'; % changed for version 6 (when this was set to 'yes' there was no subsequent call to volumewrite) cfg.write= 'no'; % changed for version 6 sourcetempIntN = ft_volumenormalise(cfg, sourcetempInt); % this whole cfg and function call added for version 6 cfg=[]; % cfg.parameter = string, describing the functional data to be processed, e.g. 'pow', 'coh' or 'nai' % cfg.filename = filename without the extension % cfg.filetype = 'analyze', 'spm', 'vmp' or 'vmr' % cfg.vmpversion = 1 or 2 (default) version of the vmp-format to use % cfg.coordinates = 'spm, 'ctf' or empty for interactive (default = []) cfg.parameter='pow'; cfg.filename=filename; cfg.filetype = 'spm'; cfg.spmversion = 'SPM8'; % capitalized after first error message from vers 6 % cfg.dataformat='nifti'; % added after first error message from vers 6 % commented out after 2nd error message from vers 6 %cfg.vmpversion=2; % this is a filetype, like spm, so don't need to specify unless cfg.filetyp='vmp' cfg.coordinates='spm'; ft_volumewrite(cfg,sourcetempIntN); On Wed, Feb 23, 2011 at 7:50 AM, jan-mathijs schoffelen wrote: Dear Jen, I notice that indeed in the documentation section of ft_write_volume there is a FIXME behind nifti. Yet, nifti format seems to be supported by ft_write_volume (at least in a recent version of fieldtrip). Did you try it at all (and ran into problems) or were you held back by the FIXME statement? Could you just try it out using a recent fieldtrip function? Thanks and best wishes Jan-Mathijs On Feb 23, 2011, at 2:21 AM, Jen Whitman wrote: Hello, While writing beamformed images to spm2 format in a previous version of fieldtrip (now lost due to a computer crash), I was able to get nice-looking results; networks of brain regions consistent with existing literature. When I try to write images from the same dataset and the same analysis to spm8 format, my results (t-images computed across subjects) end up being single clusters spanning large sections of the brain (e.g. a 'blob' spanning all of one hemisphere but not the other). Unfortunately, some aspects of my planned data analyses cannot be performed on spm2 images, so I have to find a way of writing to successfully to nifti format. I just noticed that in the comments in the ft_write_volume function, which I am calling via ft_volumewrite, it says 'FIXME' next to nifti under the list of supported dataformats. Is there by any chance a patch out there for writing nifti images? Thanks! _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip -------------- next part -------------- An HTML attachment was scrubbed... URL: From bick35 at gmail.com Fri Apr 15 20:12:02 2011 From: bick35 at gmail.com (Steph Bickel) Date: Fri, 15 Apr 2011 14:12:02 -0400 Subject: [FieldTrip] Postdoc position available in New York Message-ID: Post doctoral research position available for research using a multimodal imaging approach at the Hofstra University School of Medicine in partnership with the North Shore LIJ Health System, NY, USA. Studies involve surgical epilepsy patients undergoing intracranial electrophysiological monitoring for seizure detection and functional electrical stimulation mapping. Ongoing research projects include: 1) validation of task-based and resting state fMRI and DTI using electrical stimulation mapping and ECog; 2) investigation of the neuronal dynamics underlying selective attention and active sensing, language, object identification and auditory stream analysis; and 3) prediction of seizure spread using electrophysiological and MRI markers. Responsibilities will include designing and overseeing fMRI and ECoG experiments, data analysis and the coordination of access to patients for research studies. Candidates should have M.D. and/or Ph.D. degrees and have some background in fMRI, electrophysiology, and/or data analysis (Matlab). Please submit CV and short statement of interest to Dr. Ashesh Mehta at *amehta at nshs.edu* for more information. -------------- next part -------------- An HTML attachment was scrubbed... URL: From bick35 at gmail.com Sat Apr 16 00:04:38 2011 From: bick35 at gmail.com (Steph Bickel) Date: Fri, 15 Apr 2011 18:04:38 -0400 Subject: [FieldTrip] Postdoc position available in New York for intracranial EEG and fMRI Message-ID: Post doctoral research position available for research using a multimodal imaging approach at the Hofstra University School of Medicine in partnership with the North Shore LIJ Health System, NY, USA. Studies involve surgical epilepsy patients undergoing intracranial electrophysiological monitoring for seizure detection and functional electrical stimulation mapping. Ongoing research projects include: 1) validation of task-based and resting state fMRI and DTI using electrical stimulation mapping and ECog; 2) investigation of the neuronal dynamics underlying selective attention and active sensing, language, object identification and auditory stream analysis; and 3) prediction of seizure spread using electrophysiological and MRI markers. Responsibilities will include designing and overseeing fMRI and ECoG experiments, data analysis and the coordination of access to patients for research studies. Candidates should have M.D. and/or Ph.D. degrees and have some background in fMRI, electrophysiology, and/or data analysis (Matlab). Please submit CV and short statement of interest to Dr. Ashesh Mehta at *amehta at nshs.edu* for more information. -------------- next part -------------- An HTML attachment was scrubbed... URL: From max.taubert at gmail.com Sun Apr 17 13:44:31 2011 From: max.taubert at gmail.com (Max T.) Date: Sun, 17 Apr 2011 13:44:31 +0200 Subject: [FieldTrip] using a four shell model Message-ID: Dear all, I am new to fieldtrip and I currently tried to do a simple dipole fit on simulated data. I tried to analyse EEG data (33 channels) which was forward modeled (outside fieldtrip) using a single dipole and a four shell headmodel with radii of 85mm for the head, 6mm for the scalp, 7mm for the bone and 1mm for the csf. I tried several ideas on how to transfer this head model into fieldtrip. Unfortunately, none of my dipole fits inside fieldtrip suited my forward model. My script looks like this: avg = besa2fieldtrip('data.mul'); avg.elec = ft_read_sens('data_elec.sfp'); vol.o = [0 0 0]; vol.r = [0.84 0.85 0.92 1]; vol.c = [0.3300 1 0.0042 0.3300]; cfg = []; cfg.elec = avg.elec; cfg.vol = vol; cfg.gridsearch = 'no'; cfg.model = 'regional'; dipol = ft_dipolefitting(cfg,avg); I would appreciate any help with this. Max Taubert From bleichner.martin at gmail.com Mon Apr 18 11:39:32 2011 From: bleichner.martin at gmail.com (Martin Bleichner) Date: Mon, 18 Apr 2011 11:39:32 +0200 Subject: [FieldTrip] BCI in 2011 and 8th BCI2000 workshop: Early Registration Deadline April 20th In-Reply-To: References: Message-ID: Dear Colleague, Please note that the early registration-deadline for the two-day symposium 'Brain-Computer Interfacing in 2011' and the 8th BCI2000 workshop is approaching fast. After April 20th, participation is subject to increased registration fees. If you are interested in interfacing with the human brain, and would like to learn about the future directions of BCI research, register now on www.bci2011.eu. Yours Sincerely, The Organizing Committee ------------------------------ *‘Brain-Computer Interfacing in 20**1**1**’* What is this? A two-day symposium on Brain-Computer Interfacing When and Where? Utrecht, Netherlands, May 20&21, 2011 By Whom? UMC Utrecht/Rudolf Magnus Institute and the BrainGain Consortium For Whom? Anyone interested in: Human Brain Function Interfacing with the human brain and mind Developing solutions for paralyzed patients Who speaks? Brendan Allison, Bernhard Graimann, Eberhard Fetz, Beata Jarosiewicz, Jean-Philippe Lachaux, Eric Leuthardt, Phil Kennedy, Christa Neuper, Nick Ramsey, Gerwin Schalk, Bill Shain, Andrew Schwartz, Jonathan Wolpaw For more information, please visit www.bci2011.eu ** *T**he **8th **BCI2000 workshop* What is this? A two-day workshop on Brain-Computer Interfacing and BCI2000 When and Where? Utrecht, Netherlands, May 18&19, 2011 By Whom? UMC Utrecht/Rudolf Magnus Institute and BCI2000 For Whom? Anyone interested in: Human Brain Function Interfacing with the human brain and mind Developing solutions for paralyzed patients Program: Lectures that describe relevant technical aspects of the BCI2000 system including implementation with C++, Matlab, Fieldtrip or Python. Hands‐on practical tutorials where participants use BCI systems to control a cursor on a computer screen and to spell words just by thinking. Exercises, in which participants build and configure a BCI with their own signal processing methods, applications, or assistive devices. For more information, please visit www.bci2011.eu -------------- next part -------------- An HTML attachment was scrubbed... URL: From a.llera at donders.ru.nl Tue Apr 19 14:39:26 2011 From: a.llera at donders.ru.nl (Alberto Llera) Date: Tue, 19 Apr 2011 14:39:26 +0200 Subject: [FieldTrip] question In-Reply-To: References: Message-ID: Hey Martin I am trying to register for the symposium, and i came across a little problem. Do you know what the enrollment number it is? Thanks in advanced and see you in Utrech (again) Alberto ------------------- > Dear Colleague, > > > > Please note that the early registration-deadline for the two-day symposium > 'Brain-Computer Interfacing in 2011' and the 8th BCI2000 workshop is > approaching fast. After April 20th, participation is subject to increased > registration fees. > > > > If you are interested in interfacing with the human brain, and would like > to > learn about the future directions of BCI research, register now on > www.bci2011.eu. > > > > Yours Sincerely, > > The Organizing Committee > > > ------------------------------ > > > > > > *‘Brain-Computer Interfacing in 20**1**1**’* > > > > What is this? A two-day symposium on Brain-Computer > Interfacing > > > > When and Where? Utrecht, Netherlands, May 20&21, 2011 > > > > By Whom? UMC Utrecht/Rudolf Magnus Institute and the > BrainGain Consortium > > > > For Whom? Anyone interested in: > > Human Brain Function > > Interfacing with the human brain > and > mind > > Developing solutions for paralyzed > patients > > > > Who speaks? Brendan Allison, Bernhard Graimann, Eberhard > Fetz, Beata Jarosiewicz, Jean-Philippe Lachaux, Eric Leuthardt, > > Phil Kennedy, Christa Neuper, Nick > Ramsey, Gerwin Schalk, Bill Shain, Andrew Schwartz, Jonathan Wolpaw > > > > For more information, please visit www.bci2011.eu > > > > > > ** > > *T**he **8th **BCI2000 workshop* > > > What is this? A two-day workshop on Brain-Computer > Interfacing and BCI2000 > > > > When and Where? Utrecht, Netherlands, May 18&19, 2011 > > > > By Whom? UMC Utrecht/Rudolf Magnus Institute and BCI2000 > > > > For Whom? Anyone interested in: > > Human Brain Function > > Interfacing with the human brain and > mind > > Developing solutions for paralyzed > patients > > > > Program: Lectures that describe relevant technical > aspects of the BCI2000 system including implementation with C++, > Matlab, Fieldtrip or Python. > > Hands‐on practical tutorials where > participants use BCI systems to control a cursor on a computer screen and > to > spell words just by thinking. > > Exercises, in which participants > build > and configure a BCI with their own signal processing methods, > applications, > or assistive devices. > > > > For more information, please visit www.bci2011.eu > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip -- Alberto Llera Arenas Ph.D. Student Donders Institute for Brain, Cognition and Behaviour Radboud University Nijmegen Geert Grooteplein 21, route 126 Nijmegen, The Netherlands Tel: +31(0)24 3614230 http://www.mbfys.ru.nl/staff/a.llera/ From H.Rossiter at ion.ucl.ac.uk Wed Apr 20 12:48:08 2011 From: H.Rossiter at ion.ucl.ac.uk (Holly Rossiter) Date: Wed, 20 Apr 2011 11:48:08 +0100 Subject: [FieldTrip] FFT on EMG data Message-ID: <004701cbff48$6fe11020$4fa33060$@Rossiter@ion.ucl.ac.uk> Hi, I am trying to run an FFT on some EMG data to obtain the peak frequency. This is the script I am using... D= spm_eeg_load; emg = D.ftraw(0); cfg=[]; cfg.method='mtmfft'; cfg.output='pow'; cfg.taper='hanning'; cfg.channel={'Lforearm'}; cfg.foi= [5 80];% frequency band - foilim or just foi?? freq=ft_freqanalysis(cfg,emg); figure semilogy(freq.freq, freq.powspctrm(1,:), 'b-'); However, I keep getting this error... processing trial 1, ??? Undefined function or variable "dum". Error in ==> ft_freqanalysis_mtmfft at 345 fprintf('nfft: %d samples, taper length: %d samples, %d tapers\n',length(dum),size(tap,2),numtap); Error in ==> ft_freqanalysis at 111 [freq] = feval(sprintf('ft_freqanalysis_%s',lower(cfg.method)), cfg, data); Do you know how to fix this error? Thanks, Holly -------------- next part -------------- An HTML attachment was scrubbed... URL: From jan.schoffelen at donders.ru.nl Wed Apr 20 13:50:12 2011 From: jan.schoffelen at donders.ru.nl (jan-mathijs schoffelen) Date: Wed, 20 Apr 2011 13:50:12 +0200 Subject: [FieldTrip] FFT on EMG data In-Reply-To: <004701cbff48$6fe11020$4fa33060$@Rossiter@ion.ucl.ac.uk> References: <004701cbff48$6fe11020$4fa33060$@Rossiter@ion.ucl.ac.uk> Message-ID: <06E20A36-FFC2-4D83-AB63-F48FA0D2F0D1@donders.ru.nl> Hi Holly, What version of fieldtrip are you using? Best Jan-M On Apr 20, 2011, at 12:48 PM, Holly Rossiter wrote: > Hi, > > I am trying to run an FFT on some EMG data to obtain the peak > frequency. This is the script I am using... > > D= spm_eeg_load; > emg = D.ftraw(0); > > cfg=[]; > > cfg.method='mtmfft'; > cfg.output='pow'; > cfg.taper='hanning'; > cfg.channel={'Lforearm'}; > cfg.foi= [5 80];% frequency band - foilim or just foi?? > freq=ft_freqanalysis(cfg,emg); > > figure > semilogy(freq.freq, freq.powspctrm(1,:), 'b-'); > > However, I keep getting this error... > > processing trial 1, ??? Undefined function or variable "dum". > > Error in ==> ft_freqanalysis_mtmfft at 345 > fprintf('nfft: %d samples, taper length: %d samples, %d > tapers\n',length(dum),size(tap,2),numtap); > > Error in ==> ft_freqanalysis at 111 > [freq] = > feval(sprintf('ft_freqanalysis_%s',lower(cfg.method)), cfg, > data); > > Do you know how to fix this error? > > Thanks, > > Holly > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 -------------- next part -------------- An HTML attachment was scrubbed... URL: From max.taubert at gmail.com Wed Apr 20 16:08:39 2011 From: max.taubert at gmail.com (Max T.) Date: Wed, 20 Apr 2011 16:08:39 +0200 Subject: [FieldTrip] [Fieldtrip] dipole-fitting problem Message-ID: Dear all, I am new to fieldtrip and I currently tried to do a simple dipole fit on EEG data using a four-shell headmodel. The data consists of 96 trials which I preprocess and average through fieldtrip, then I do the dipole fit using two symmetric dipoles. As I only wanted to try out the fitting-capabilities of fieldtrip, I skipped artifact detection etc. The problem I encountered is that the fitting results from fieldtrip vastly differ from results that come from BESA, the dipoles have totaly different positions. May this be caused by the different algorithms of FT and BESA? Or must there be something wrong with my script? Besides this, does FT have capabilities to plot source-level data using the method 'surface' if there's no individual MRI available? This is what my script looks like: cfg = []; cfg.dataset = 'data.cnt'; cfg.trialdef.eventtype = 'trigger'; cfg.trialdef.eventvalue = 1; cfg.trialdef.prestim = 0.5; cfg.trialdef.poststim = 1; cfg = ft_definetrial(cfg); cfg.channel=1:30; cfg.demean = 'yes'; cfg.baselinewindow = [-0.1 0]; data = ft_preprocessing(cfg); avg = ft_timelockanalysis(cfg,data); vol.o = [0 0 0]; vol.c = [0.3300 1 0.0042 0.3300]; vol.r = [0.84 0.85 0.92 1]; elec = ft_read_sens('electrodes.sfp'); cfg.numdipoles = 2; cfg.symmetry = 'x'; cfg.channel = 1:30; cfg.elec = elec; cfg.vol = vol; cfg.gridsearch = 'yes'; cfg.grid.resolution = 1; cfg.model = 'regional'; cfg.latency = [0.07 0.08]; cfg.channel = 'all'; dipol = ft_dipolefitting(cfg,avg); Thanks in advance Max Taubert From r.vandermeij at donders.ru.nl Wed Apr 20 17:59:51 2011 From: r.vandermeij at donders.ru.nl (Roemer van der Meij) Date: Wed, 20 Apr 2011 11:59:51 -0400 Subject: [FieldTrip] FFT on EMG data In-Reply-To: <004701cbff48$6fe11020$4fa33060$@Rossiter@ion.ucl.ac.uk> References: <004701cbff48$6fe11020$4fa33060$@Rossiter@ion.ucl.ac.uk> Message-ID: <4DAF02F7.9090709@donders.ru.nl> Hi Holly, A few months ago we revised the entire frequency analysis module, if you download the latest version you should be fine. In the old situation, cfg.foi could only be used for method = mtmconvol, and cfg.foilim was the way to go with method = mtmfft. In the new version, you can also request specific frequencies with mtmfft using cfg.foi, next to using cfg.foilim to define a range. Note though, a cfg.foi = [5 80] (/= not cfg.foilim/) will only result in frequency estimates at 5 and 80 Hz, whereas a cfg.foilim = [5 80] would result in all possible frequencies in that range. Best, Roemer On 20-Apr-11 06:48, Holly Rossiter wrote: > > Hi, > > I am trying to run an FFT on some EMG data to obtain the peak > frequency. This is the script I am using... > > D= spm_eeg_load; > > emg = D.ftraw(0); > > cfg=[]; > > cfg.method='mtmfft'; > > cfg.output='pow'; > > cfg.taper='hanning'; > > cfg.channel={'Lforearm'}; > > cfg.foi= [5 80];% frequency band - foilim or just foi?? > > freq=ft_freqanalysis(cfg,emg); > > figure > > semilogy(freq.freq, freq.powspctrm(1,:), 'b-'); > > However, I keep getting this error... > > processing trial 1, ??? Undefined function or variable "dum". > > Error in ==> ft_freqanalysis_mtmfft at 345 > > fprintf('nfft: %d samples, taper length: %d samples, %d > > tapers\n',length(dum),size(tap,2),numtap); > > Error in ==> ft_freqanalysis at 111 > > [freq] = > > feval(sprintf('ft_freqanalysis_%s',lower(cfg.method)), cfg, > > data); > > Do you know how to fix this error? > > Thanks, > > Holly > > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip -- Roemer van der Meij M.Sc. PhD student Donders Institute for Brain, Cognition and Behaviour Centre for Cognition Radboud University Nijmegen P.O. Box 9104 6500 HE Nijmegen The Netherlands Tel: +31(0)24 3655932 E-mail: r.vandermeij at donders.ru.nl -------------- next part -------------- An HTML attachment was scrubbed... URL: From r.vandermeij at donders.ru.nl Wed Apr 20 20:16:25 2011 From: r.vandermeij at donders.ru.nl (Roemer van der Meij) Date: Wed, 20 Apr 2011 14:16:25 -0400 Subject: [FieldTrip] Changed phase convention 'wavelet' ('wltconvol') Message-ID: <4DAF22F9.4080007@donders.ru.nl> Hi everybody, We have changed the meaning of phases of /raw/ Fourier-coefficients of method = 'wavelet' (previously 'wltconvol'), so that it is in alignment with method = 'mtmconvol'. All output is now phase-shifted such that an angle of 0 of any Fourier-coefficient always means a peak of an oscillation in the data, and an angle of pi/-pi will always mean the trough of an oscillation (wavelet wise angle = 0 is implemented as cosine at peak, and sine in up-going flank) (also documented in the FAQ section here ) Processed phases, like those in a cross-spectral density array and it's children like coherence, PLVs etc., will /not /be different. You will only notice the difference if you choose cfg.output = 'fourier'. The change will be latest version on our FTP-server tonight. Best, Roemer -- Roemer van der Meij M.Sc. PhD student Donders Institute for Brain, Cognition and Behaviour Centre for Cognition Radboud University Nijmegen P.O. Box 9104 6500 HE Nijmegen The Netherlands Tel: +31(0)24 3655932 E-mail: r.vandermeij at donders.ru.nl -------------- next part -------------- An HTML attachment was scrubbed... URL: From Heng-RuMay.Tan at glasgow.ac.uk Thu Apr 21 14:27:25 2011 From: Heng-RuMay.Tan at glasgow.ac.uk (May (Heng-Ru May TAN)) Date: Thu, 21 Apr 2011 13:27:25 +0100 Subject: [FieldTrip] Question about SPM brain templates including the cerebellum Message-ID: <4DB022AD.20701@glasgow.ac.uk> Hi I was wondering if there exists within the folders of Fieldtrip, surface source-plot MRI templates which includes the cerebellum, and if not, how could one create a template which consists of the cerebellum, too? Any help would be gratefully appreciated! Thanks. May -------------- next part -------------- An HTML attachment was scrubbed... URL: From manuel.mercier at einstein.yu.edu Thu Apr 21 22:10:45 2011 From: manuel.mercier at einstein.yu.edu (Manuel Mercier) Date: Thu, 21 Apr 2011 16:10:45 -0400 Subject: [FieldTrip] Statistics (against baseline) Message-ID: <4DB08F45.2090803@einstein.yu.edu> Dear Field-trippers First of all, I would like to thank the Fieldtrip mentors, and all the contributors. I find this toolbox more than a toolbox. The website and the active mailing list makes it stimulating and definitively instructive. Which motivates me to share with you some reflections and questions. I did some statistics on data from implanted electrodes (ECoG) in human. For the purpose of this analysis, I mainly looked at the time frequency space, so I first ran the following script: (with data being the output of the /ft_preprocessing/ function) load data; trig = [3 4 5]; for cond = 1:length(trig) cfg = []; cfg.method = 'wavelet'; cfg.output = 'fourier'; cfg.foi = 2:2:50; cfg.toi = -0.5:0.02:0.05; cfg.keeptrials = 'yes'; cfg.keeptaper = 'yes'; cfg.width = 5; cfg.trials = find(data.trialinfo(:,1) == trig(cond)); TF_Mwlt_fourier{cond} = ft_freqanalysis(cfg, data); end; I used Morlet wavelet because a previous post from Robert that recommended not to use multitapering for PLF (http://mailman.science.ru.nl/pipermail/fieldtrip/2006-March/000446.html). And also to facilitate comparison with other studies. The output being Fourier, I computed power and phase concentration (aka PLF or ITC), (both calculated at single trial level for stats and then averaged for /ft_multiplot//TFR/ ) powplf_data.pow = abs(data.fourierspctrm) .^2; powplf_data.powspctrm = abs(mean(squeeze(powplf_data.pow),1)); powplf_data.plf = data.fourierspctrm./abs(data.fourierspctrm); powplf_data.plf_average = abs(mean(squeeze(powplf_data.plf),1)); The first statistics I wanted to run was a comparison of the power and the PLF for each condition against their respective baseline period. To do so I applied the following method (based on Delorme et Makeig 2004) for a given channel: - draw a value within the baseline period for each trial (independently for each time point and frequency). - average along the trial dimension - repeat those steps thousand time - use those thousand repetition to construct the distribution - count the percentage of values above (/below) the observed post-onset value from the data (at a given latency and frequency). Define significance for power using two tails (p < 0.025 & p > 0.975), and one tail for PLF (p<0.05). I decided to write my own function because I was not sure that I could do it using Field trip. I noticed that there is the /statfun_actvsblT/ that can be specified in /cfg.method/ field of /ft_freqstatistics/. But I have two concerns about it: - I prefer to used a randomization method for distribution reason. Indeed even if for power it seems to be ok with my data (seems to be normally distributed), it is by definition not the case with PLF (which is more like a gamma or F distribution; because values are more concentrated near to zero, rare value toward 1). - this function average over the specified baseline time period. This average step makes more sense to me in the case of ERP analysis, but less with time frequency. Especially with PLF, since the average will have the tendency to compress the values toward 0. I guess that an alternative would be to use /statfun_diff_itc/ with one condition being post-onset period and the other "fake" condition being the baseline. But in this case the length (duration) of the two pools should be identical, as the time points would be "paired". Am I correct about this or is it more flexible ? Here are the points I would like to discuss: 1) I think I did my analysis the correct way, but it might not be the case, so any comments about the method are very welcome. 2) when someone is interested in the phase, is there a "better" method to compute the time frequency transform? (or any method is good as long as there is no frequency smoothing) 3) can we imagine a future extra/new option in the /statfun_actvsbl/ that would allow for choosing between averaging and taking a random time point within the specified time period ? Maybe this makes less sense for T-stats than in the case of a randomization test ? and even less when this is not done at the level of single trials ? Thanks in advance for your comments. Manuel -- Manuel Mercier, PhD Research Fellow Cognitive Neurophysiology Laboratory, Children's Evaluation and Rehabilitation Center (CERC), Departments of Pediatrics Albert Einstein College of Medicine, 1225 Morris Park Avenue Bronx , New York, NY 10461 phone: +1 (718) 862 1824 fax: +1 (718) 862 1807 -------------- next part -------------- An HTML attachment was scrubbed... URL: From jan.schoffelen at donders.ru.nl Fri Apr 22 09:30:58 2011 From: jan.schoffelen at donders.ru.nl (jan-mathijs schoffelen) Date: Fri, 22 Apr 2011 09:30:58 +0200 Subject: [FieldTrip] Question about SPM brain templates including the cerebellum In-Reply-To: <4DB022AD.20701@glasgow.ac.uk> References: <4DB022AD.20701@glasgow.ac.uk> Message-ID: <79DC2E75-C97A-4DCB-B387-250F7E0B8F00@donders.ru.nl> Dear May, The surface files contain only a triangulation of the neo-cortical surface. Typically, software packages creating high-resolution meshes of the brain (such as freesurfer) exclude the cerebellum. For the figures in the famous Schoffelen et al 2008 paper (Neuroimage) I created the surfaces (with cerebellum) using a segmented template MRI (using SPM) and then, after some image processing (smoothing filling etc), called the matlab isosurface function. This gives a triangulated surface which can be used for visualization. Note that this procedure does not yield topologically a sphere, so it cannot be used for inflation. Best, Jan-Mathijs On Apr 21, 2011, at 2:27 PM, May (Heng-Ru May TAN) wrote: > Hi > > I was wondering if there exists within the folders of Fieldtrip, > surface source-plot MRI templates which includes the cerebellum, and > if not, how could one create a template which consists of the > cerebellum, too? > > Any help would be gratefully appreciated! > > Thanks. > May > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 -------------- next part -------------- An HTML attachment was scrubbed... URL: From Heng-RuMay.Tan at glasgow.ac.uk Fri Apr 22 19:39:35 2011 From: Heng-RuMay.Tan at glasgow.ac.uk (Heng-Ru May Tan) Date: Fri, 22 Apr 2011 18:39:35 +0100 Subject: [FieldTrip] Question about SPM brain templates including the cerebellum In-Reply-To: <79DC2E75-C97A-4DCB-B387-250F7E0B8F00@donders.ru.nl> References: <4DB022AD.20701@glasgow.ac.uk> <79DC2E75-C97A-4DCB-B387-250F7E0B8F00@donders.ru.nl> Message-ID: <4DB1BD57.5000803@glasgow.ac.uk> Dear Jan-Mathijs, Thank you for the sharing the information. Before trying to 're-invent the wheel', might it be possible for Fieldtrip to incorporate the famous Schoffelen et al., 2008's cerebellar-included MRI template for visualization purpose -- with the awareness that it will not permit inflation? Unless my limited knowledge on brain graphics has prevented me from appreciating the importance of 'inflation' within the Fieldtrip coding environment; in which case, I hope to be enlightened, if it is within anyone's knowledge. Also, does the 'isosurface' function preserve the MNI coordinates, if I should try to create my own template? Many thanks, again! And Happy Easter to all. May On 22/04/2011 08:30, jan-mathijs schoffelen wrote: > Dear May, > > The surface files contain only a triangulation of the neo-cortical > surface. > Typically, software packages creating high-resolution meshes of the > brain (such as freesurfer) exclude the cerebellum. > For the figures in the famous Schoffelen et al 2008 paper (Neuroimage) > I created the surfaces (with cerebellum) using a segmented template > MRI (using SPM) and then, after some image processing (smoothing > filling etc), called the matlab isosurface function. This gives a > triangulated surface which can be used for visualization. Note that > this procedure does not yield topologically a sphere, so it cannot be > used for inflation. > > Best, > > Jan-Mathijs > > On Apr 21, 2011, at 2:27 PM, May (Heng-Ru May TAN) wrote: > >> Hi >> >> I was wondering if there exists within the folders of Fieldtrip, >> surface source-plot MRI templates which includes the cerebellum, and >> if not, how could one create a template which consists of the >> cerebellum, too? >> >> Any help would be gratefully appreciated! >> >> Thanks. >> May >> >> _______________________________________________ >> fieldtrip mailing list >> fieldtrip at donders.ru.nl >> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > > Dr. J.M. (Jan-Mathijs) Schoffelen > Donders Institute for Brain, Cognition and Behaviour, > Centre for Cognitive Neuroimaging, > Radboud University Nijmegen, The Netherlands > J.Schoffelen at donders.ru.nl > Telephone: 0031-24-3614793 > > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip -------------- next part -------------- An HTML attachment was scrubbed... URL: From politzerahless at gmail.com Fri Apr 22 22:17:05 2011 From: politzerahless at gmail.com (Stephen Politzer-Ahles) Date: Fri, 22 Apr 2011 15:17:05 -0500 Subject: [FieldTrip] Data preprocessing after ICA artifact correction Message-ID: Hello everyone, I am interested in using FieldTrip to remove EOG artifact on my data before other processing. I followed the example at http://fieldtrip.fcdonders.nl/example/use_independent_component_analysis_ica_to_remove_eog_artifactsto remove EOG artifact across all conditions (that is to say, when I imported the data with ft_definetrial I imported all conditions into a single structure). After having done that, I hope to a) preprocess the data (re-reference, demean/baseline-correct, and maybe low-pass filter); b) separate the data such that the data for each condition is stored in a separate variable, so that it's ready for event-related averaging. However, it seems that I can't use ft_definetrial() and ft_preprocess() on data that I have already imported into FieldTrip and done ICA on. Does anyone have any example code for how I can do the above processing steps on the data after I have already done the ICA artifact correction in FieldTrip? Thank you very much, Steve Politzer-Ahles -- Stephen Politzer-Ahles University of Kansas Linguistics Department http://www.linguistics.ku.edu/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From lieneke.janssen at student.ru.nl Tue Apr 26 11:32:27 2011 From: lieneke.janssen at student.ru.nl (Lieneke. Janssen) Date: Tue, 26 Apr 2011 11:32:27 +0200 (CEST) Subject: [FieldTrip] preprocessing per channel Message-ID: <2008169134.446724.1303810347507.JavaMail.root@monoceros.zimbra.ru.nl> Dear Fieldtrippers, I was quite happy to find the possibility in fieldtrip to do preprocessing per channel instead of (the default) per trial. Unfortunately, if I say cfg.method = 'channel'; the output is overwritten with every channel that is preprocessed, so I end up only having the output from the last channel, whereas if the method is 'trial', the function nicely combines all preprocessed trials into the output file. Is there anything that can be done to get one preprocessing output file using cfg.method = 'channel';? Thanks! Best, Lieneke From eelke.spaak at donders.ru.nl Tue Apr 26 11:45:52 2011 From: eelke.spaak at donders.ru.nl (Eelke Spaak) Date: Tue, 26 Apr 2011 11:45:52 +0200 Subject: [FieldTrip] preprocessing per channel In-Reply-To: References: <2008169134.446724.1303810347507.JavaMail.root@monoceros.zimbra.ru.nl> Message-ID: Dear Lieneke, To be honest, I have never tried preprocessing per channel before, so I might not understand exactly what you mean by 'the output is overwritten with every channel that is preprocessed'. If so, please correct me :) The cfg.method option governs only how data is read from disk, not which parts of the data the preprocessing is applied to. If you only want to preprocess certain channels, you can use cfg.channel = {...} to specify which channels to preprocess. If you have different data sets (e.g., corresponding to different output structures from ft_preprocessing) that contain different channels (but the same trials), you can concatenate them by using ft_appenddata (http://fieldtrip.fcdonders.nl/reference/ft_appenddata). Hopefully this was somewhat helpful, Best, Eelke 2011/4/26 Lieneke. Janssen : > Dear Fieldtrippers, > > I was quite happy to find the possibility in fieldtrip to do preprocessing per channel instead of (the default) per trial. > > Unfortunately, if I say cfg.method = 'channel'; the output is overwritten with every channel that is preprocessed, so I end up only having the output from the last channel, whereas if the method is 'trial', the function nicely combines all preprocessed trials into the output file. > > Is there anything that can be done to get one preprocessing output file using cfg.method = 'channel';? > > Thanks! > > Best, > Lieneke > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > From H.Rossiter at ion.ucl.ac.uk Tue Apr 26 15:00:23 2011 From: H.Rossiter at ion.ucl.ac.uk (Holly Rossiter) Date: Tue, 26 Apr 2011 14:00:23 +0100 Subject: [FieldTrip] FFT on EMG data Message-ID: <002401cc0411$e7974f30$b6c5ed90$@Rossiter@ion.ucl.ac.uk> Hi, Downloading the newest version of Fieldtrip fixed the previous error but not I am getting another error following this script... D= spm_eeg_load; emg = D.ftraw(0); cfg=[]; cfg.method='mtmfft'; cfg.output='pow'; cfg.taper='hanning'; cfg.channel={'Lforearm'}; cfg.foilim= [5 80];% frequency band - foilim or just foi?? freq=ft_freqanalysis(cfg,emg); figure semilogy(freq.freq, freq.powspctrm(1,:), 'b-'); Error ??? Index exceeds matrix dimensions. Error in ==> ft_freqanalysis at 574 acttboi = squeeze(~isnan(spectrum(1,1,foiind(ifoi),:))); Error in ==> FFT_EMG at 15 freq=ft_freqanalysis(cfg,emg); Any advice would be much appreciated. Thanks, Holly -------------- next part -------------- An HTML attachment was scrubbed... URL: From daz at MIT.EDU Tue Apr 26 17:42:36 2011 From: daz at MIT.EDU (David Ziegler) Date: Tue, 26 Apr 2011 11:42:36 -0400 Subject: [FieldTrip] PLV/coherence on Neuromag gradiometer data Message-ID: <4DB6E7EC.8000601@mit.edu> Hi Fieldtrippers, I am interested in analyzing PLV or coherence in my MEG data from a Neuromag 306 system. In the past, for looking at power alone, I have calculated TFRs on the gradiometer data, then ran ft_combineplanar to average the gradiometer pairs. Should I use the same approach for calculating the cross-spectral density, or does this create any problems when I go to combine the results for gradiometer pairs? In particular, I am trying to wrap my head around how I would set up cfg.channelcmb if I want to look at all channel pairs, but then want to subsequently perform ft_combineplanar. (or maybe this is the wrong approach altogether?) Thanks, David -- David A. Ziegler Department of Brain and Cognitive Sciences Massachusetts Institute of Technology 43 Vassar St,46-5121 Cambridge, MA 02139 Tel: 617-258-0765 Fax: 617-253-1504 daz at mit.edu -------------- next part -------------- An HTML attachment was scrubbed... URL: From lieneke.janssen at student.ru.nl Wed Apr 27 10:55:33 2011 From: lieneke.janssen at student.ru.nl (Lieneke. Janssen) Date: Wed, 27 Apr 2011 10:55:33 +0200 (CEST) Subject: [FieldTrip] preprocessing per channel In-Reply-To: <414049370.459969.1303894250317.JavaMail.root@monoceros.zimbra.ru.nl> Message-ID: <1120852439.460085.1303894533421.JavaMail.root@monoceros.zimbra.ru.nl> Hi Eelke and others, Thanks for your reply. ft_appenddata might indeed solve my problem! It would be nice though if cfg.method would work the same for preprocessing per trial and preprocessing per channel. If cfg.method is not specified, fieldtrip assumes cfg.method = trial. It then preprocesses every trial subsequently and gives you one output file in which all subsequently preprocessed trials are present. Since I would like to preprocess my complete dataset as if one big trial as a first step, which apparently takes too much memory, I wanted to preprocess per channel (for all channels) instead of per trial. So I set cfg.method to channel. It then preprocesses every channel subsequently (as 'per trial'), but only gives you the output of the most recently processed channel (in contrary to 'per trial'). I therefore assume that output/data from the previously preprocessed channel gets lost (i.e. overwritten) when fieldtrip continues with the next channel. So unfortunately you end up with the output of the last preprocessed channel only. This does not happen for preprocessing per trial (i.e. ending up with the output of the last preprocessed trial only). I hope this problem can be solved sooner or later. Until then, I'll append my data :). Best, Lieneke ----- "Eelke Spaak" wrote: > From: "Eelke Spaak" > To: "Email discussion list for the FieldTrip project" > Sent: Tuesday, April 26, 2011 11:45:52 AM > Subject: Re: [FieldTrip] preprocessing per channel > > Dear Lieneke, > > To be honest, I have never tried preprocessing per channel before, so > I might not understand exactly what you mean by 'the output is > overwritten with every channel that is preprocessed'. If so, please > correct me :) > > The cfg.method option governs only how data is read from disk, not > which parts of the data the preprocessing is applied to. If you only > want to preprocess certain channels, you can use cfg.channel = {...} > to specify which channels to preprocess. If you have different data > sets (e.g., corresponding to different output structures from > ft_preprocessing) that contain different channels (but the same > trials), you can concatenate them by using ft_appenddata > (http://fieldtrip.fcdonders.nl/reference/ft_appenddata). > > Hopefully this was somewhat helpful, > Best, > > Eelke > > 2011/4/26 Lieneke. Janssen : > > Dear Fieldtrippers, > > > > I was quite happy to find the possibility in fieldtrip to do > preprocessing per channel instead of (the default) per trial. > > > > Unfortunately, if I say cfg.method = 'channel'; the output is > overwritten with every channel that is preprocessed, so I end up only > having the output from the last channel, whereas if the method is > 'trial', the function nicely combines all preprocessed trials into the > output file. > > > > Is there anything that can be done to get one preprocessing output > file using cfg.method = 'channel';? > > > > Thanks! > > > > Best, > > Lieneke > > _______________________________________________ > > fieldtrip mailing list > > fieldtrip at donders.ru.nl > > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > > > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip From r.oostenveld at donders.ru.nl Thu Apr 28 14:31:43 2011 From: r.oostenveld at donders.ru.nl (Robert Oostenveld) Date: Thu, 28 Apr 2011 14:31:43 +0200 Subject: [FieldTrip] change in yokogawa trigger and raw data handling Message-ID: <793850E4-B56E-4656-B755-9C8D0BCB52B9@donders.ru.nl> Dear Yokogawa users Earlier this week I made a change to the handling of Yokogawa data that might require some small updates to your analysis scripts. Let me summarise it in this mail. Although most of the meta information and header information is still read with the yokogawa p-files, the sqd data can now also be read with the sqdproject/sqdread function. As of this week the code is included in fieldtrip/external/sqdproject and will automatically be added to your path. The consequence is that much less memory is needed if you only want to read a few channels (or the trigger channels). You can now use it on a small memory computer. Another consequence is that data is expressed in fT and mV (if I am correct) and not no T and V, so please note the scaling difference. Furthermore, I have added an option to ft_read_event/read_trigger that automatically detects whether you have downgoing or upgoing flanks in the data. It used to detect both, and then it was up to you to select e.g. '169_up' as the relevant one. It will now (try to) autodetect whether your data has downgoing or upgoing flanks and only detect the triggers for the approprate one. The resulting trigger code does not have the down/up tag any more, so you should now work with '169' instead. And finally the ft_read_event function now has the 'trigindx' option documented (see also http://bugzilla.fcdonders.nl/show_bug.cgi?id=494#c2) and has an option 'threshold' for the flank detection in the analog trigger channels. best regards, Robert PS if you want to follow up to this mail with potential problems or suggestions for improvements, please use http://bugzilla.fcdonders.nl and file a "bug" for the yokogawa component. From jan.schoffelen at donders.ru.nl Fri Apr 29 12:30:13 2011 From: jan.schoffelen at donders.ru.nl (jan-mathijs schoffelen) Date: Fri, 29 Apr 2011 12:30:13 +0200 Subject: [FieldTrip] change in scaling of sine tapers Message-ID: <8E52B0AC-BA08-4B45-8CB1-89005BAE2851@donders.ru.nl> Dear all, I made a change to how ft_freqanalysis scales the tapers when cfg.taper has been specified to be 'sine'. This has been done to make the handling of this type of taper consistent with the other (multi) tapers. Each of the tapers used has now a norm of 1, which makes the scale of the powerspectrum of the tapered time series consistent across different tapers. Initially, this was not the case for the sine taper. For backward compatibility I implemented the (we think less appropriate) scaled version. In order to use the scaled sine tapers, you need to specify cfg.taper = 'sine_old' prior to calling ft_freqanalysis. Best wishes, Jan-Mathijs Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 From a.wollbrink at uni-muenster.de Fri Apr 1 16:37:45 2011 From: a.wollbrink at uni-muenster.de (Andreas Wollbrink) Date: Fri, 01 Apr 2011 16:37:45 +0200 Subject: [FieldTrip] Dipole time course In-Reply-To: <2E7764CB-846C-4A40-A4FB-7F6C3376C465@ucdenver.edu> References: <722089035bbba.4d93df8a@mail.uh.edu> <0A4E2DDD-B79F-4B96-A777-CB880E117016@donders.ru.nl> <2E7764CB-846C-4A40-A4FB-7F6C3376C465@ucdenver.edu> Message-ID: <4D95E339.6070604@uni-muenster.de> Hi Don, I just tried out your approach on how to achieve the source waveform based on a given dipole source but failed calculating the scalar product of the inverse leadfield matrix and the normed orientation vector: W = dot(Li,Qn); error message: A and B must be same size. May I ask you for a suggestion? Best, Andreas On 03/31/11 17:57, Rojas, Don wrote: > Mehmet et al. > > As a follow up to this, once you have the orientation info from the > dipole, the source space projection you wish to achieve to derive the > timecourse can be done as follows (or at least something similar to > this), assuming you have the fieldtrip data (data) the source, and the > volume conductor (vol): > > L = ft_compute_leadfield(source.dip.pos, data.grad,vol); % leadfields > Li = pinv(L); % pseudoinverse of L > Qn = double(orientation_vector)/norm(orientation_vector); % normed > orientation vector > W = dot(Li,Qn); % weights for projection to source space > waveform = dot(data,repmat(W',1,length(data))); % source waveform > > where the orientation_vector is a 1 x 3 vector of qx, qy and qz. This > can be had from one of your sources from source.dip.mom, or from the > suggestion of Jan-Mathijs. I don't know if the data you have is an > average that you want to project into source space or individual trials. > If you want to do this with the individual trials, you'd just need to do > the last piece of code above as a for loop through your trials - you > don't have to recompute the weights (W) used for the projection. > > Best, > > Don > > On Mar 31, 2011, at 1:38 AM, jan-mathijs schoffelen wrote: > >> Hi Mehmet, >> >> I forward this to the mailing list, so that people can participate in >> the thread. >> >> I do not fully understand where the orientation information in the vol >> comes from. The description of the volume conductor is namely a >> geometrical object, containing either a (set of) triangulated >> surface(s), to describe compartment boundaries, or the description of >> a (set of) sphere(s), with an origin and a radius. >> The outcome of the dipolefitting algorithm gives you a field, called >> dip.mom, describing the dipole moment as a function of time. At each >> time point, the three numbers reflect the instantaneous orientation of >> the dipole. Since you are working with MEG, I assume that the >> orientation of this dipole is actually defined on a plane, because we >> routinely suppress the component with the most radial orientation from >> the leadfield. One way of reducing the dimension is to check whether >> there is a single dominant orientation over time. This can be achieved >> by doing a pca (or svd) of dip.mom. The ratio of the first two >> singular values specifies how well the dipole can be approximated as >> one having a fixed orientation. The left singular vectors give you the >> projection vectors, and thus specify the orientation. In other words >> [u,s,v] = svd(dip.mom). if s(1,1) >> s(2,2), one could justify to use >> u(:,1) as the 'orientation' of the corresponding dipole. >> >> Best, >> >> Jan-Mathijs >> >> >> >> >> >> Begin forwarded message: >> >>> *From: *Mehmet-Akif Coskun >> > >>> *Date: *March 31, 2011 8:57:30 AM GMT+02:00 >>> *To: *jan-mathijs schoffelen >> > >>> *Subject: **Dipole time course* >>> >>> Hi Jan, >>> Thanks for all your help. I am really close to get the dipole time courses. Everything looks fine in terms of reading data, preprocessing, creating headmodel and fitting a dipole. The last part is to obtain a dipole time course. >>> >>> I actually read through the previous emails in discussion list and followed the advices. I used the code below to obtain the leadfield and then project the pinv'ed leadfield onto ERF to get the dipole course. But the leadfield is 3D so i get 3 time courses. >>> % prepare leadfield cfg=[]; cfg.grad= hdr.grad; cfg.vol=vol; cfg.channel='MEG'; cfg.grid.pos=dipM50.dip.pos; >>> [grid_ft_segment2]=ft_prepare_leadfield(cfg); >>> >>> In the email below, you suggested to an other user to multiply the 3D leadfields with the orientation estimated by the dipole fit. I checked the outcome of the dipole but there wasn't any orientation information. However, i checked the vol structure which has the orientation and multiply 3D leadfields with vol.ori and then project 1d leadfield onto ERF. I got a nice looking time course. I just wonder whether what i did is meaningful. >>> >>> Thanks >>> Mehmet >>> >>> P.S= Below is your previous email >>> I suspect that the 'orientation' onto which the pca projects the dipoles is not optimal. Perhaps you might want to try the other way, i.e. compute the leadfields in 1D, either by specifying something in cfg.grid.mom (or ori, I keep forgetting) before calling prepare_leadfield, or by postmultiplying the 3D leadfields with the orientation as estimated by the dipole fit. >> >> Dr. J.M. (Jan-Mathijs) Schoffelen >> Donders Institute for Brain, Cognition and Behaviour, >> Centre for Cognitive Neuroimaging, >> Radboud University Nijmegen, The Netherlands >> J.Schoffelen at donders.ru.nl >> Telephone: 0031-24-3614793 >> >> _______________________________________________ >> fieldtrip mailing list >> fieldtrip at donders.ru.nl >> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > > ----------------------- > Don Rojas, Ph.D. > Associate Professor of Psychiatry > U. of Colorado Denver Anschutz Medical Campus > Director, UCD Magnetoencephalography Lab > 13001 E. 17th Pl F546 > Aurora, CO 80045 > 303-724-4994 > > > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip -- ====================================================================== Andreas Wollbrink, Biomedical Engineer Institute for Biomagnetism and Biosignalanalysis Muenster University Hospital Malmedyweg 15 phone: +49-(0)251-83-52546 D-48149 Muenster mobil: +49-(0)160-98527553 Germany fax: +49-(0)251-83-56874 e-Mail: a.wollbrink at uni-muenster.de ====================================================================== From Don.Rojas at ucdenver.edu Fri Apr 1 20:15:00 2011 From: Don.Rojas at ucdenver.edu (Rojas, Don) Date: Fri, 1 Apr 2011 12:15:00 -0600 Subject: [FieldTrip] Dipole time course In-Reply-To: <1F405F51-C58D-446B-A2F2-2EBD3ACBB908@ucdenver.edu> References: <722089035bbba.4d93df8a@mail.uh.edu> <0A4E2DDD-B79F-4B96-A777-CB880E117016@donders.ru.nl> <2E7764CB-846C-4A40-A4FB-7F6C3376C465@ucdenver.edu> <4D95E339.6070604@uni-muenster.de> <1F405F51-C58D-446B-A2F2-2EBD3ACBB908@ucdenver.edu> Message-ID: Andreas, I just wrote that code snippet from memory so it figures it wouldn't work without a little clean up. I forgot what the dimensions would be of the Li and Qn variables and the dot operation has to have arrays of the same size as input. I tested an example and this correction should work for you. I also corrected a parenthetic error on the use of double in the Qn line that would not have generated an error. I added a couple of transposes here and there. But, check your sizes as follows if you have problems - often, something will just need to be transposed to get it into the proper shape. I added some info on each input and variable to hopefully clarify what I'm after in the example: source.dip.pos: 1 x 3 orientation_vector: 1 x 3 (Fieldtrip source structure orientation is 3 x 1 per dipole, so probably need to transpose if getting from source structure) L: nchannels x 3 Li: 3 x nchannels; Qn: 1 x 3, then 3 x nchannels after repmat() W: 1 x nchannels waveform: 1 x nsamples data: Fieldtrip timelock structure with avg field data.avg: nchannels x nsamples vol: volume conductor in Fieldtrip - I coded this with a single sphere model source: source output from ft_dipolefitting() Revised code example: L = ft_compute_leadfield(source.dip.pos, data.grad,vol,'reducerank',2); % leadfield Li = pinv(L); % pseudoinverse of L Qn = double(orientation_vector/norm(orientation_vector)); % normed orientation vector Qn = repmat(Qn,length(Li),1)'; % make Qn the same size as Li W = dot(Li,Qn)'; % weights for projection to source space waveform = dot(data.avg,repmat(W,1,size(data.avg,2))); % source waveform Hope that helps. I'm thinking that if your gradiometer data scaling is in meters (check your grad structure) and the input data scaling to the last dot operation is in fT, then your output scale will be A-m (1e-9), but you might want to check since I didn't confirm that. I think by default the fieldtrip MEG data are in units of T so you might need to scale your input data accordingly to get your desired output scale. But then, I'm assuming MEG gradiometer data input, so if you have something else, check your function call to ft_compute_leadfield and adjust your scaling accordingly. Don On Apr 1, 2011, at 8:37 AM, Andreas Wollbrink wrote: > Hi Don, > > I just tried out your approach on how to achieve the source waveform > based on a given dipole source but failed calculating the scalar product > of the inverse leadfield matrix and the normed orientation vector: > > W = dot(Li,Qn); > > error message: A and B must be same size. > > May I ask you for a suggestion? > > Best, > Andreas > From a.wollbrink at uni-muenster.de Mon Apr 4 15:51:26 2011 From: a.wollbrink at uni-muenster.de (Andreas Wollbrink) Date: Mon, 04 Apr 2011 15:51:26 +0200 Subject: [FieldTrip] Dipole time course In-Reply-To: References: <722089035bbba.4d93df8a@mail.uh.edu> <0A4E2DDD-B79F-4B96-A777-CB880E117016@donders.ru.nl> <2E7764CB-846C-4A40-A4FB-7F6C3376C465@ucdenver.edu> <4D95E339.6070604@uni-muenster.de> <1F405F51-C58D-446B-A2F2-2EBD3ACBB908@ucdenver.edu> Message-ID: <4D99CCDE.6000407@uni-muenster.de> Hi Don, thanks for your advices. I succeeded calculating the source waveform time series using your modified script lines. Since the number of sensors in the data.grad field was different from the number of channels in the data.avg matrix I added the following line to the beginning of your code: [vol, grad] = ft_prepare_vol_sens(vol, avgData.grad, 'channel', avgData.label); I am using data recorded with the 275 channel axial gradiometer VSM system. During the recording 3 channels were defined as bad. The noise balancing was set to 1 (first order synthetic gradiometers). Using ft_preprocessing and ft_timelockanalysis with the the setting cfg.channel = 'MEG' one ends up with 272 channels in the data.avg matrix and 281 sensors in the cfg.grad structure. Since I am not sure whether it is correct to apply the ft_prepare_vol_sens function in the way I did it I would appreciate if an expert could comment on that. Andreas On 04/01/11 20:15, Rojas, Don wrote: > Andreas, > > I just wrote that code snippet from memory so it figures it wouldn't work without a little clean up. I forgot what the dimensions would be of the Li and Qn variables and the dot operation has to have arrays of the same size as input. I tested an example and this correction should work for you. I also corrected a parenthetic error on the use of double in the Qn line that would not have generated an error. I added a couple of transposes here and there. But, check your sizes as follows if you have problems - often, something will just need to be transposed to get it into the proper shape. I added some info on each input and variable to hopefully clarify what I'm after in the example: > > source.dip.pos: 1 x 3 > orientation_vector: 1 x 3 (Fieldtrip source structure orientation is 3 x 1 per dipole, so probably need to transpose if getting from source structure) > L: nchannels x 3 > Li: 3 x nchannels; > Qn: 1 x 3, then 3 x nchannels after repmat() > W: 1 x nchannels > waveform: 1 x nsamples > data: Fieldtrip timelock structure with avg field > data.avg: nchannels x nsamples > vol: volume conductor in Fieldtrip - I coded this with a single sphere model > source: source output from ft_dipolefitting() > > Revised code example: > > L = ft_compute_leadfield(source.dip.pos, data.grad,vol,'reducerank',2); % leadfield > Li = pinv(L); % pseudoinverse of L > Qn = double(orientation_vector/norm(orientation_vector)); % normed orientation vector > Qn = repmat(Qn,length(Li),1)'; % make Qn the same size as Li > W = dot(Li,Qn)'; % weights for projection to source space > waveform = dot(data.avg,repmat(W,1,size(data.avg,2))); % source waveform > > Hope that helps. I'm thinking that if your gradiometer data scaling is in meters (check your grad structure) and the input data scaling to the last dot operation is in fT, then your output scale will be A-m (1e-9), but you might want to check since I didn't confirm that. I think by default the fieldtrip MEG data are in units of T so you might need to scale your input data accordingly to get your desired output scale. But then, I'm assuming MEG gradiometer data input, so if you have something else, check your function call to ft_compute_leadfield and adjust your scaling accordingly. > > Don > > On Apr 1, 2011, at 8:37 AM, Andreas Wollbrink wrote: > >> Hi Don, >> >> I just tried out your approach on how to achieve the source waveform >> based on a given dipole source but failed calculating the scalar product >> of the inverse leadfield matrix and the normed orientation vector: >> >> W = dot(Li,Qn); >> >> error message: A and B must be same size. >> >> May I ask you for a suggestion? >> >> Best, >> Andreas >> > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip -- ====================================================================== Andreas Wollbrink, Biomedical Engineer Institute for Biomagnetism and Biosignalanalysis Muenster University Hospital Malmedyweg 15 phone: +49-(0)251-83-52546 D-48149 Muenster mobil: +49-(0)160-98527553 Germany fax: +49-(0)251-83-56874 e-Mail: a.wollbrink at uni-muenster.de ====================================================================== From recasensmarc at gmail.com Tue Apr 5 18:54:01 2011 From: recasensmarc at gmail.com (Marc Recasens) Date: Tue, 5 Apr 2011 18:54:01 +0200 Subject: [FieldTrip] Source reconstruction and NAI Message-ID: Dear all, As far as I know it is possible to reconstruct the time-course of the sources (obtained using sourceanalysis) by projecting/multiplying the filter-weights on the data. In my case, the specific code I am using is: for i=1:nvoxels(inside) for tr=1:ntrials ts(tr,:)=(source.avg.ori{source.inside(i)}(1,:)*source.avg.filter{source.inside(i)}*data2{condit}.trial{tr}); end datvx(i,:,:)= single_trial_time_course end I used a common filter with 3 different conditions, thus I think this is the only way I have to reconstruct the activity for one of the conditions. My Question is about how to apply the NAI normalization here. Can I just divide the output of the source reconstruction by the projected noise of the filter? I am tempted to do something like that datvx(i,:,:)= single_trial_time_course ./ repmat(noise(inside),[size(ts,1), size(ts,2)] That is, I divide the power by the noise estimate (for each voxel) in every trial and time-point. Could anyone tell me whether this is a correct way to procedure? Any other workaround? Thanks in advance! -- Marc Recasens Tel.: +34 639 24 15 98 -------------- next part -------------- An HTML attachment was scrubbed... URL: From nathanweisz at mac.com Thu Apr 7 11:31:35 2011 From: nathanweisz at mac.com (Nathan Weisz) Date: Thu, 07 Apr 2011 11:31:35 +0200 Subject: [FieldTrip] cfg.latency and ft_timelockanalysis Message-ID: <934EFFDB-DED1-4F8C-BE1F-9F7AC2D9B447@mac.com> hi, i just noticed that the option cfg.latency has been deprecated from ft_timelockanalysis. does this have a specific reason? seems to be done on purpose :-) i am asking because i always thought that it was a nice feature when later using beamformer analysis (lcmv) to have a more narrow window to calculate e.g. power (using ft_sourcedescriptives) or to orient sources when later applying filters to raw data, and to have a wider window including also prestim periods for covariance estimation. of course the workaround is to run two timelocks with a redefinetrial in between. but it appears rather awkward. thanks for any input, nathan From s.mohr at psy.gla.ac.uk Thu Apr 7 12:55:04 2011 From: s.mohr at psy.gla.ac.uk (sibylle) Date: Thu, 7 Apr 2011 11:55:04 +0100 Subject: [FieldTrip] plv and sourceanalysis Message-ID: <0EA26325-41FA-4669-A95D-A643F2D8F84F@psy.gla.ac.uk> Dear Fieldtrippers, I have a couple of question and I hope someone can help me: How is it possible to compute plv (for freq data)? As far as I can remember there used to be an option within ft_sourcedescriptives, which seems to have disappeared. How can one use plv to determine connectivity in source space? Thanks a lot & best wishes, Sibylle From sklein at berkeley.edu Thu Apr 7 13:09:46 2011 From: sklein at berkeley.edu (Stanley Klein) Date: Thu, 7 Apr 2011 04:09:46 -0700 Subject: [FieldTrip] plv and sourceanalysis In-Reply-To: <0EA26325-41FA-4669-A95D-A643F2D8F84F@psy.gla.ac.uk> References: <0EA26325-41FA-4669-A95D-A643F2D8F84F@psy.gla.ac.uk> Message-ID: Speaking of plv, two weeks ago I sent out a question regarding plv, but I don't recall getting any responses. My questions were: 1) By ignoring the phasor magnitudes when summing over trials, isn't plv noisier than standard coherence that includes magnitudes? 2) By including the real part isn't plv often dominated by volume conduction that can be avoided by just looking at the imaginary part of coherence (sadly the imaginary part may be hard to interpret and it ignores the non-volume conducting contributions to the real part). My original posting included: *"I recall that when Lachaux et al. (1999) introduced it (I think it was them) I didn't understand what is the advantage of adding unit magnitude phasors. I would have thought that neglecting the magnitude of the phasor would give a noisier measure of coherence. Another worry is that the PLV includes the real part of the phasor which is contaminated by the volume conduction from the forward model. To avoid that contamination many people only look at the imaginary part (the aspect of PLV with 90 deg phase shift). The problem with the imaginary part is that one loses the information from the non-volume conduction real part."* thanks, Stan On Thu, Apr 7, 2011 at 3:55 AM, sibylle wrote: > Dear Fieldtrippers, > > I have a couple of question and I hope someone can help me: > How is it possible to compute plv (for freq data)? > As far as I can remember there used to be an option within > ft_sourcedescriptives, which seems to have disappeared. > How can one use plv to determine connectivity in source space? > > Thanks a lot & best wishes, > > Sibylle > > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jan.schoffelen at donders.ru.nl Thu Apr 7 14:14:10 2011 From: jan.schoffelen at donders.ru.nl (jan-mathijs schoffelen) Date: Thu, 7 Apr 2011 14:14:10 +0200 Subject: [FieldTrip] cfg.latency and ft_timelockanalysis In-Reply-To: <934EFFDB-DED1-4F8C-BE1F-9F7AC2D9B447@mac.com> References: <934EFFDB-DED1-4F8C-BE1F-9F7AC2D9B447@mac.com> Message-ID: Hi Nathan, Yes, we thought long and deep about this, and we concluded that cfg.latency was to be kicked out as an option. We had the impression that the old-style cfg options were a bit confusing and counter- intuitive. First of all, apologies that we did not communicate this change more clearly, we kind of assumed that hardly anyone used this option anyway. This is our take on it: If you use ft_timelockanalysis in order to compute a covariance to be used in ft_sourceanalysis, cfg.covariancewindow is the option that specifies the latency for the covariance. A call to ft_timelockanalysis will then give you the event-related field for free, but the latency of this ERF is not anymore confined (which was previously done by cfg.latency). What we thought was confusing (and potentially unwanted), is that the user could specify totally different windows for the covariance computation and for the latency, which could lead to the spatial filters being optimized for a stretch of data totally different from the source-reconstructed data the user would be looking at after the call to ft_sourceanalysis. It is the covariancewindow that eventually determines the shape of the spatial filters and the idea was that one could just as well project the whole ERF through the spatial filters and apply latency constraints later on, if necessary. This functionality (i.e. the application of latency constraints is not yet fully operational, but we're working on it). If the user would like to do some fancy stuff (which you seem to like ;o) ) we'd rather make it explicit that ft_sourceanalysis needs to be run twice (in the first round obviously with cfg.keepfilter = 'yes'), instead of running the risk that the user doesn't fully obtain what he/she asked for. Obviously, the scenario you sketch is perfectly valid and we understand that you like it to still be supported. We however hope that you appreciate the fact that we trust our expert users to take this little inconvenience for granted at the benefit of more transparent code and less trouble for the novice users. Best wishes, Jan-Mathijs On Apr 7, 2011, at 11:31 AM, Nathan Weisz wrote: > hi, > > i just noticed that the option cfg.latency has been deprecated from > ft_timelockanalysis. > > does this have a specific reason? seems to be done on purpose :-) > > i am asking because i always thought that it was a nice feature when > later using beamformer analysis (lcmv) to have a more narrow window > to calculate e.g. power (using ft_sourcedescriptives) or to orient > sources when later applying filters to raw data, and to have a wider > window including also prestim periods for covariance estimation. > > of course the workaround is to run two timelocks with a > redefinetrial in between. but it appears rather awkward. > > thanks for any input, > nathan > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 From jan.schoffelen at donders.ru.nl Thu Apr 7 14:23:58 2011 From: jan.schoffelen at donders.ru.nl (jan-mathijs schoffelen) Date: Thu, 7 Apr 2011 14:23:58 +0200 Subject: [FieldTrip] Source reconstruction and NAI In-Reply-To: References: Message-ID: Dear Marc, It seems from your question that you are interested in single trial reconstructed time series. If your purpose is to do a statistical comparison across a set of conditions I would not do a noise normalization at all. You mention that you used a spatial filter common to the three conditions. As a consequence, the estimate of the noise will be independent of the condition, so any normalization you would apply just leads to a scaling of the data, and will not change the outcome of your statistical test. Yet, I understand that it sometimes makes sense to do a normalization in order to be able to make a sensible visualization of the data (i.e. removing the big central blob). Also, in this case I would compute a descriptive statistic across the conditions, rather than normalizing with an estimate of the projected noise (which in FieldTrip is rather rudimentary because it assumes the noise to be spatially white). You could for example compute an F-value from a one-factor, three level anova, or do a pairwise comparison of conditions using a t-test. Another alternative (which does not affect your statistical test either), is to work with norm-normalized leadfields. This will take away the blob in the centre of the volume, and facilitates visualization. Best wishes, Ja-Mathijs On Apr 5, 2011, at 6:54 PM, Marc Recasens wrote: > Dear all, > > As far as I know it is possible to reconstruct the time-course of > the sources (obtained using sourceanalysis) by projecting/ > multiplying the filter-weights on the data. > In my case, the specific code I am using is: > for i=1:nvoxels(inside) > > for tr=1:ntrials > > ts(tr,:)=(source.avg.ori{source.inside(i)} > (1,:)*source.avg.filter{source.inside(i)}*data2{condit}.trial{tr}); > > end > > datvx(i,:,:)= single_trial_time_course > > end > > I used a common filter with 3 different conditions, thus I think > this is the only way I have to reconstruct the activity for one of > the conditions. > My Question is about how to apply the NAI normalization here. Can I > just divide the output of the source reconstruction by the projected > noise of the filter? I am tempted to do something like that > > datvx(i,:,:)= single_trial_time_course ./ repmat(noise(inside), > [size(ts,1), size(ts,2)] > > That is, I divide the power by the noise estimate (for each voxel) > in every trial and time-point. Could anyone tell me whether this is > a correct way to procedure? Any other workaround? > > > > Thanks in advance! > > -- > Marc Recasens > Tel.: +34 639 24 15 98 > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 -------------- next part -------------- An HTML attachment was scrubbed... URL: From jan.schoffelen at donders.ru.nl Thu Apr 7 14:28:18 2011 From: jan.schoffelen at donders.ru.nl (jan-mathijs schoffelen) Date: Thu, 7 Apr 2011 14:28:18 +0200 Subject: [FieldTrip] plv and sourceanalysis In-Reply-To: <0EA26325-41FA-4669-A95D-A643F2D8F84F@psy.gla.ac.uk> References: <0EA26325-41FA-4669-A95D-A643F2D8F84F@psy.gla.ac.uk> Message-ID: <6ADFF688-0149-4940-9F99-C83741BD5308@donders.ru.nl> Dear Sibylle, You confuse me a bit. You mention ft_sourcedescriptives in combination with freq data. Do you mean that you have source-level data in the frequency domain, or do you have freq-data, as in sensor level data having been processed by ft_freqanalysis? In the former case, I do not recall that ft_sourcedescriptives could compute a plv. In the latter case: it was indeed supported by ft_freqdescriptives. A while ago we moved the functionality of ft_freqdescriptives dealing with coherence/plv etc to ft_connectivityanalysis. So I'd suggest to have a look there. Also, I think it should be possible to use ft_connectivityanalysis to compute source level plv, but this may still need some tweaking. Best wishes, Jan-Mathijs On Apr 7, 2011, at 12:55 PM, sibylle wrote: > Dear Fieldtrippers, > > I have a couple of question and I hope someone can help me: > How is it possible to compute plv (for freq data)? > As far as I can remember there used to be an option within > ft_sourcedescriptives, which seems to have disappeared. > How can one use plv to determine connectivity in source space? > > Thanks a lot & best wishes, > > Sibylle > > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 From jan.schoffelen at donders.ru.nl Thu Apr 7 14:29:54 2011 From: jan.schoffelen at donders.ru.nl (jan-mathijs schoffelen) Date: Thu, 7 Apr 2011 14:29:54 +0200 Subject: [FieldTrip] plv and sourceanalysis In-Reply-To: References: <0EA26325-41FA-4669-A95D-A643F2D8F84F@psy.gla.ac.uk> Message-ID: <5AADFF53-1C6A-4541-A21E-DF462587EB20@donders.ru.nl> Dear Stan, Here is my take on it: > Speaking of plv, two weeks ago I sent out a question regarding plv, > but I don't recall getting any responses. My questions were: > > 1) By ignoring the phasor magnitudes when summing over trials, isn't > plv noisier than standard coherence that includes magnitudes? > Yes > 2) By including the real part isn't plv often dominated by volume > conduction that can be avoided by just looking at the imaginary part > of coherence (sadly the imaginary part may be hard to interpret and > it ignores the non-volume conducting contributions to the real part). I agree. What's the question here? Best wishes, Jan-Mathijs From Gregor.Volberg at psychologie.uni-regensburg.de Thu Apr 7 15:10:05 2011 From: Gregor.Volberg at psychologie.uni-regensburg.de (Gregor Volberg) Date: Thu, 07 Apr 2011 15:10:05 +0200 Subject: [FieldTrip] Antw: plv and sourceanalysis In-Reply-To: <0EA26325-41FA-4669-A95D-A643F2D8F84F@psy.gla.ac.uk> References: <0EA26325-41FA-4669-A95D-A643F2D8F84F@psy.gla.ac.uk> Message-ID: <4D9DD3CD0200005700008F9F@gwsmtp1.uni-regensburg.de> Dear Sybille, the plv option is now within ft_connectivityanalysis. I was successful with the code given below (ft_freqanalysis changed a bit in newer versions of fieldtrip so there might be some small corrections necessary). As much as I know, a plv analysis on source activity is not implemented as one of fieldtrip's high-level functions, but could be done by hand. One possibility is to use source analysis to identify regions of interest, which can then be used as "virtual electrodes" for ft_freqanalysis and ft_connectivityanalysis, just as the real electrodes in sensor space data. In order for that to work, you need to reconstruct single trial source activity at your ROIs. How this is done depends on the method you use for source analysis. There are some recent postings where a method is described for an LCMV beamformer. Hope this helps, Gregor cfg_tfr = []; cfg_tfr.output = 'fourier'; cfg_tfr.channel = 'all'; cfg_tfr.method = 'mtmconvol' cfg_tfr.taper = 'hanning' cfg_tfr.toi = -0.6:0.02:1 cfg_tfr.foi = [8 9 10 11 12]; cfg_tfr.t_ftimwin = 7./cfg_tfr.foi; cfg_tfr.channelcmb = {'EEG', 'EEG'} freq_output = ft_freqanalysis(cfg_tfr,data); cfg_con = []; cfg_con.method = 'plv'; plv = ft_connectivityanalysis(cfg_con, freq_output); -- Dr. rer. nat. Gregor Volberg ( mailto:gregor.volberg at psychologie.uni-regensburg.de ) University of Regensburg Institute for Experimental Psychology 93040 Regensburg, Germany Tel: +49 941 943 3862 Fax: +49 941 943 3233 http://www.psychologie.uni-regensburg.de/Greenlee/team/volberg/volberg.html >>> sibylle 4/7/2011 12:55 PM >>> Dear Fieldtrippers, I have a couple of question and I hope someone can help me: How is it possible to compute plv (for freq data)? As far as I can remember there used to be an option within ft_sourcedescriptives, which seems to have disappeared. How can one use plv to determine connectivity in source space? Thanks a lot & best wishes, Sibylle _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip -------------- next part -------------- An HTML attachment was scrubbed... URL: From grigu at cbs.mpg.de Thu Apr 7 15:19:17 2011 From: grigu at cbs.mpg.de (Maren Grigutsch) Date: Thu, 07 Apr 2011 15:19:17 +0200 Subject: [FieldTrip] plv and sourceanalysis In-Reply-To: <5AADFF53-1C6A-4541-A21E-DF462587EB20@donders.ru.nl> References: <0EA26325-41FA-4669-A95D-A643F2D8F84F@psy.gla.ac.uk> <5AADFF53-1C6A-4541-A21E-DF462587EB20@donders.ru.nl> Message-ID: <4D9DB9D5.1000000@cbs.mpg.de> jan-mathijs schoffelen wrote: > Dear Stan, > > Here is my take on it: > >> Speaking of plv, two weeks ago I sent out a question regarding plv, >> but I don't recall getting any responses. My questions were: >> >> 1) By ignoring the phasor magnitudes when summing over trials, isn't >> plv noisier than standard coherence that includes magnitudes? >> > > Yes Yes, if your signals are coherent. But I would not say that plv and coherence are just two different measures for the same thing. There exist dynamic regimes where only the phases of oscillators are coupled and the amplitudes are not. This type of coupling can be detected by measuring plv but not by computing coherence. > > >> 2) By including the real part isn't plv often dominated by volume >> conduction that can be avoided by just looking at the imaginary part >> of coherence (sadly the imaginary part may be hard to interpret and >> it ignores the non-volume conducting contributions to the real part). > > I agree. What's the question here? > > Best wishes, > > Jan-Mathijs > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip -- Max Planck Institute for Human Cognitive and Brain Sciences Dipl.-Phys. Maren Grigutsch mailto:grigu at cbs.mpg.de Stephanstr.1a http://www.cbs.mpg.de 04103 Leipzig, Germany phone/fax: +49 341 9940-136/-2260 From s.mohr at psy.gla.ac.uk Thu Apr 7 16:10:12 2011 From: s.mohr at psy.gla.ac.uk (sibylle) Date: Thu, 7 Apr 2011 15:10:12 +0100 Subject: [FieldTrip] plv and sourceanalysis In-Reply-To: <6ADFF688-0149-4940-9F99-C83741BD5308@donders.ru.nl> References: <0EA26325-41FA-4669-A95D-A643F2D8F84F@psy.gla.ac.uk> <6ADFF688-0149-4940-9F99-C83741BD5308@donders.ru.nl> Message-ID: <2F46431A-C0AF-4165-BC4E-E0F36B16A1A4@psy.gla.ac.uk> Dear Jan-Mathijs, Yes indeed, it is freq-data (preprocessed by ft_freqanalysis). Apologies for the confusion. Subsequently, we localized the effects using ft_sourceanalysis (cfg.method = 'dics') and identified regions of interest, which I'd like to use now for the connectivityanalysis I assume in order to use plv I would need to run ft_connectivityanalysis at the freq-level. Anyway, thanks a lot for your help! I will have a look at the ft_connectivityanalysis options. Thanks again & best wishes, Sibylle On 7 Apr 2011, at 13:28, jan-mathijs schoffelen wrote: > Dear Sibylle, > > You confuse me a bit. You mention ft_sourcedescriptives in > combination with freq data. Do you mean that you have source-level > data in the frequency domain, or do you have freq-data, as in sensor > level data having been processed by ft_freqanalysis? In the former > case, I do not recall that ft_sourcedescriptives could compute a > plv. In the latter case: it was indeed supported by > ft_freqdescriptives. > A while ago we moved the functionality of ft_freqdescriptives > dealing with coherence/plv etc to ft_connectivityanalysis. So I'd > suggest to have a look there. Also, I think it should be possible to > use ft_connectivityanalysis to compute source level plv, but this > may still need some tweaking. > > Best wishes, > > Jan-Mathijs > > > On Apr 7, 2011, at 12:55 PM, sibylle wrote: > >> Dear Fieldtrippers, >> >> I have a couple of question and I hope someone can help me: >> How is it possible to compute plv (for freq data)? >> As far as I can remember there used to be an option within >> ft_sourcedescriptives, which seems to have disappeared. >> How can one use plv to determine connectivity in source space? >> >> Thanks a lot & best wishes, >> >> Sibylle >> >> >> _______________________________________________ >> fieldtrip mailing list >> fieldtrip at donders.ru.nl >> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > > Dr. J.M. (Jan-Mathijs) Schoffelen > Donders Institute for Brain, Cognition and Behaviour, > Centre for Cognitive Neuroimaging, > Radboud University Nijmegen, The Netherlands > J.Schoffelen at donders.ru.nl > Telephone: 0031-24-3614793 > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip -------------- next part -------------- An HTML attachment was scrubbed... URL: From s.mohr at psy.gla.ac.uk Thu Apr 7 16:20:23 2011 From: s.mohr at psy.gla.ac.uk (sibylle) Date: Thu, 7 Apr 2011 15:20:23 +0100 Subject: [FieldTrip] Antw: plv and sourceanalysis In-Reply-To: <4D9DD3CD0200005700008F9F@gwsmtp1.uni-regensburg.de> References: <0EA26325-41FA-4669-A95D-A643F2D8F84F@psy.gla.ac.uk> <4D9DD3CD0200005700008F9F@gwsmtp1.uni-regensburg.de> Message-ID: Dear Gregor, I think that is exactly what I was looking for! Thanks a lot for your fast reply, this is really helpful :) Actually, I already ran ft_sourceanalysis (using DICS) to identify regions of interest. I will have a look at the LCMV beamformer postings you've recommended. Best wishes, Sibylle On 7 Apr 2011, at 14:10, Gregor Volberg wrote: > Dear Sybille, > > the plv option is now within ft_connectivityanalysis. I was > successful with the code given below (ft_freqanalysis changed a bit > in newer versions of fieldtrip so there might be some small > corrections necessary). As much as I know, a plv analysis on source > activity is not implemented as one of fieldtrip's high-level > functions, but could be done by hand. One possibility is to use > source analysis to identify regions of interest, which can then be > used as "virtual electrodes" for ft_freqanalysis and > ft_connectivityanalysis, just as the real electrodes in sensor space > data. In order for that to work, you need to reconstruct single > trial source activity at your ROIs. How this is done depends on the > method you use for source analysis. There are some recent postings > where a method is described for an LCMV beamformer. > Hope this helps, > Gregor > > > cfg_tfr = []; > cfg_tfr.output = 'fourier'; > cfg_tfr.channel = 'all'; > cfg_tfr.method = 'mtmconvol' > cfg_tfr.taper = 'hanning' > cfg_tfr.toi = -0.6:0.02:1 > cfg_tfr.foi = [8 9 10 11 12]; > cfg_tfr.t_ftimwin = 7./cfg_tfr.foi; > cfg_tfr.channelcmb = {'EEG', 'EEG'} > freq_output = ft_freqanalysis(cfg_tfr,data); > > cfg_con = []; > cfg_con.method = 'plv'; > plv = ft_connectivityanalysis(cfg_con, freq_output); > > > > > > > -- > Dr. rer. nat. Gregor Volberg > ( mailto:gregor.volberg at psychologie.uni-regensburg.de ) > University of Regensburg > Institute for Experimental Psychology > 93040 Regensburg, Germany > Tel: +49 941 943 3862 > Fax: +49 941 943 3233 > http://www.psychologie.uni-regensburg.de/Greenlee/team/volberg/volberg.html > > > >>> sibylle 4/7/2011 12:55 PM >>> > Dear Fieldtrippers, > > I have a couple of question and I hope someone can help me: > How is it possible to compute plv (for freq data)? > As far as I can remember there used to be an option within > ft_sourcedescriptives, which seems to have disappeared. > How can one use plv to determine connectivity in source space? > > Thanks a lot & best wishes, > > Sibylle > > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip -------------- next part -------------- An HTML attachment was scrubbed... URL: From amrgermany at yahoo.com Fri Apr 8 17:48:50 2011 From: amrgermany at yahoo.com (Amr Ayoub) Date: Fri, 8 Apr 2011 16:48:50 +0100 (BST) Subject: [FieldTrip] =?iso-8859-1?q?_Phd_and_Post-Doc-Positions_in_T=FCbin?= =?iso-8859-1?q?gen_Germany?= Message-ID: <623810.1342.qm@web29006.mail.ird.yahoo.com> Dear all, Prof. Jan Born is offering Phd and Post-Doctoral positions in Tuebingen. Please find the attatched two announcements for details. Thank you, Amr Ayoub -- Institut fuer Neuroendokrinologie Universitaetsklinikum Schleswig-Holstein Ratzeburger Allee 160, Bldg. 50.1 23538 Luebeck Germany Tel: +49 (0)451-500 3642 Fax: +49 (0)451-500 3640 Email: ayoub at kfg.uni-luebeck.de -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: Post-doctoral position 2011.doc Type: application/msword Size: 27648 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: Vacancy_Tuebingen_Germany.pdf Type: application/pdf Size: 7416 bytes Desc: not available URL: From recasensmarc at gmail.com Fri Apr 8 19:49:08 2011 From: recasensmarc at gmail.com (Marc Recasens) Date: Fri, 08 Apr 2011 19:49:08 +0200 Subject: [FieldTrip] Source reconstruction and NAI In-Reply-To: References: Message-ID: <4D9F4A94.8050106@gmail.com> Thank you Jan-Mathijs, I actually did not think about that... However, I did this just to remove the central blobs, independently of the effect it may cause in the different conditions. My aim is to use montecarlo non-parametric statistics afterwards to localize the sources. Don't you think there's gonna be a huge difference between nai-normalized and non-normalized datasets? Thanks again! El 07/04/2011 14:23, jan-mathijs schoffelen escribió: > Dear Marc, > > It seems from your question that you are interested in single trial > reconstructed time series. If your purpose is to do a statistical > comparison across a set of conditions I would not do a noise > normalization at all. You mention that you used a spatial filter > common to the three conditions. As a consequence, the estimate of the > noise will be independent of the condition, so any normalization you > would apply just leads to a scaling of the data, and will not change > the outcome of your statistical test. > Yet, I understand that it sometimes makes sense to do a normalization > in order to be able to make a sensible visualization of the data (i.e. > removing the big central blob). Also, in this case I would compute a > descriptive statistic across the conditions, rather than normalizing > with an estimate of the projected noise (which in FieldTrip is rather > rudimentary because it assumes the noise to be spatially white). You > could for example compute an F-value from a one-factor, three level > anova, or do a pairwise comparison of conditions using a t-test. > Another alternative (which does not affect your statistical test > either), is to work with norm-normalized leadfields. This will take > away the blob in the centre of the volume, and facilitates visualization. > > Best wishes, > > Ja-Mathijs > > > On Apr 5, 2011, at 6:54 PM, Marc Recasens wrote: > >> Dear all, >> >> As far as I know it is possible to reconstruct the time-course of the >> sources (obtained using sourceanalysis) by projecting/multiplying the >> filter-weights on the data. >> In my case, the specific code I am using is: >> >> for i=1:nvoxels(inside) >> >> for tr=1:ntrials >> >> >> ts(tr,:)=(source.avg.ori{source.inside(i)}(1,:)*source.avg.filter{source.inside(i)}*data2{condit}.trial{tr}); >> >> end >> >> datvx(i,:,:)= single_trial_time_course >> >> end >> >> I used a common filter with 3 different conditions, thus I think this >> is the only way I have to reconstruct the activity for one of the >> conditions. >> My Question is about how to apply the NAI normalization here. Can I >> just divide the output of the source reconstruction by the projected >> noise of the filter? I am tempted to do something like that >> >> datvx(i,:,:)= single_trial_time_course ./ >> repmat(noise(inside),[size(ts,1), size(ts,2)] >> >> That is, I divide the power by the noise estimate (for each voxel) in >> every trial and time-point. Could anyone tell me whether this is a >> correct way to procedure? Any other workaround? >> >> >> Thanks in advance! >> >> -- >> Marc Recasens >> Tel.: +34 639 24 15 98 >> >> _______________________________________________ >> fieldtrip mailing list >> fieldtrip at donders.ru.nl >> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > > Dr. J.M. (Jan-Mathijs) Schoffelen > Donders Institute for Brain, Cognition and Behaviour, > Centre for Cognitive Neuroimaging, > Radboud University Nijmegen, The Netherlands > J.Schoffelen at donders.ru.nl > Telephone: 0031-24-3614793 > > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip -- Marc Recasens Tel.: +34 639 24 15 98 -------------- next part -------------- An HTML attachment was scrubbed... URL: From yuvharpaz at gmail.com Fri Apr 8 21:09:01 2011 From: yuvharpaz at gmail.com (Yuval Harpaz) Date: Fri, 8 Apr 2011 22:09:01 +0300 Subject: [FieldTrip] Source reconstruction and NAI In-Reply-To: <4D9F4A94.8050106@gmail.com> References: <4D9F4A94.8050106@gmail.com> Message-ID: Dear Marc If you do normalize every condition it may be better to normalize all conditions to one baseline. this way differences between conditions will not result from differences On 8 April 2011 20:49, Marc Recasens wrote: > Thank you Jan-Mathijs, > I actually did not think about that... > However, I did this just to remove the central blobs, independently of the > effect it may cause in the different conditions. > > My aim is to use montecarlo non-parametric statistics afterwards to > localize the sources. Don't you think there's gonna be a huge difference > between nai-normalized and non-normalized datasets? > yes, they are not comarable. before normlization the scale is very small (say 10^ -13) and after it is a ratio, say 1.8. > > > Thanks again! > > > > El 07/04/2011 14:23, jan-mathijs schoffelen escribió: > > Dear Marc, > > It seems from your question that you are interested in single trial > reconstructed time series. If your purpose is to do a statistical comparison > across a set of conditions I would not do a noise normalization at all. You > mention that you used a spatial filter common to the three conditions. As a > consequence, the estimate of the noise will be independent of the condition, > so any normalization you would apply just leads to a scaling of the data, > and will not change the outcome of your statistical test. > Yet, I understand that it sometimes makes sense to do a normalization in > order to be able to make a sensible visualization of the data (i.e. removing > the big central blob). Also, in this case I would compute a descriptive > statistic across the conditions, rather than normalizing with an estimate of > the projected noise (which in FieldTrip is rather rudimentary because it > assumes the noise to be spatially white). You could for example compute an > F-value from a one-factor, three level anova, or do a pairwise comparison of > conditions using a t-test. > Another alternative (which does not affect your statistical test either), > is to work with norm-normalized leadfields. This will take away the blob in > the centre of the volume, and facilitates visualization. > > Best wishes, > > Ja-Mathijs > > > On Apr 5, 2011, at 6:54 PM, Marc Recasens wrote: > > Dear all, > > As far as I know it is possible to reconstruct the time-course of the > sources (obtained using sourceanalysis) by projecting/multiplying the > filter-weights on the data. > In my case, the specific code I am using is: > > for i=1:nvoxels(inside) > > for tr=1:ntrials > > > ts(tr,:)=(source.avg.ori{source.inside(i)}(1,:)*source.avg.filter{source.inside(i)}*data2{condit}.trial{tr}); > > end > > datvx(i,:,:)= single_trial_time_course > > end > I used a common filter with 3 different conditions, thus I think this is > the only way I have to reconstruct the activity for one of the conditions. > My Question is about how to apply the NAI normalization here. Can I just > divide the output of the source reconstruction by the projected noise of the > filter? I am tempted to do something like that > > datvx(i,:,:)= single_trial_time_course ./ > repmat(noise(inside),[size(ts,1), size(ts,2)] > > That is, I divide the power by the noise estimate (for each voxel) in > every trial and time-point. Could anyone tell me whether this is a correct > way to procedure? Any other workaround? > > > Thanks in advance! > > -- > Marc Recasens > Tel.: +34 639 24 15 98 > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > > > Dr. J.M. (Jan-Mathijs) Schoffelen > Donders Institute for Brain, Cognition and Behaviour, > Centre for Cognitive Neuroimaging, > Radboud University Nijmegen, The Netherlands > J.Schoffelen at donders.ru.nl > Telephone: 0031-24-3614793 > > > _______________________________________________ > fieldtrip mailing listfieldtrip at donders.ru.nlhttp://mailman.science.ru.nl/mailman/listinfo/fieldtrip > > > > -- > Marc Recasens > Tel.: +34 639 24 15 98 > > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > -- Y.Harpaz a link to the BIU MEG lab: http://faculty.biu.ac.il/~goldsa/index.html " Why, Dan," ask the people in Artificial Intelligence, "do you waste your time conferring with those neuroscientists? They wave their hands about information processing and worry about where it happens, and which neurotransmitters are involved, and all those boring facts, but they haven't a clue about the computational requirements of higher cognitive functions." "Why," ask the neuroscientists, "do you waste your time on the fantasies of Artificial Intelligence? They just invent whatever machinery they want, and say unpardonably ignorant things about the brain." The cognitive psychologists, meanwhile, are accused of concocting models with neither biological plausibility nor proven computational powers; the anthropologists wouldn't know a model if they saw one, and the philosophers, as we all know, just take in each other's laundry, warning about confusions they themselves have created, in an arena bereft of both data and empirically testable theories. With so many idiots working on the problem, no wonder consciousness is still a mystery.* Philosopher Daniel Dennet, consciousness explained, pp. 225* -------------- next part -------------- An HTML attachment was scrubbed... URL: From yuvharpaz at gmail.com Fri Apr 8 21:10:59 2011 From: yuvharpaz at gmail.com (Yuval Harpaz) Date: Fri, 8 Apr 2011 22:10:59 +0300 Subject: [FieldTrip] Source reconstruction and NAI In-Reply-To: References: <4D9F4A94.8050106@gmail.com> Message-ID: oops, missing words below in red On 8 April 2011 22:09, Yuval Harpaz wrote: > Dear Marc > If you do normalize every condition it may be better to normalize all > conditions to one baseline. this way differences between conditions will not > result from differences > between the baselines > > On 8 April 2011 20:49, Marc Recasens wrote: > >> Thank you Jan-Mathijs, >> I actually did not think about that... >> However, I did this just to remove the central blobs, independently of the >> effect it may cause in the different conditions. >> >> My aim is to use montecarlo non-parametric statistics afterwards to >> localize the sources. Don't you think there's gonna be a huge difference >> between nai-normalized and non-normalized datasets? >> > yes, they are not comarable. before normlization the scale is very small > (say 10^ -13) and after it is a ratio, say 1.8. > >> >> >> Thanks again! >> >> >> >> El 07/04/2011 14:23, jan-mathijs schoffelen escribió: >> >> Dear Marc, >> >> It seems from your question that you are interested in single trial >> reconstructed time series. If your purpose is to do a statistical comparison >> across a set of conditions I would not do a noise normalization at all. You >> mention that you used a spatial filter common to the three conditions. As a >> consequence, the estimate of the noise will be independent of the condition, >> so any normalization you would apply just leads to a scaling of the data, >> and will not change the outcome of your statistical test. >> Yet, I understand that it sometimes makes sense to do a normalization in >> order to be able to make a sensible visualization of the data (i.e. removing >> the big central blob). Also, in this case I would compute a descriptive >> statistic across the conditions, rather than normalizing with an estimate of >> the projected noise (which in FieldTrip is rather rudimentary because it >> assumes the noise to be spatially white). You could for example compute an >> F-value from a one-factor, three level anova, or do a pairwise comparison of >> conditions using a t-test. >> Another alternative (which does not affect your statistical test either), >> is to work with norm-normalized leadfields. This will take away the blob in >> the centre of the volume, and facilitates visualization. >> >> Best wishes, >> >> Ja-Mathijs >> >> >> On Apr 5, 2011, at 6:54 PM, Marc Recasens wrote: >> >> Dear all, >> >> As far as I know it is possible to reconstruct the time-course of the >> sources (obtained using sourceanalysis) by projecting/multiplying the >> filter-weights on the data. >> In my case, the specific code I am using is: >> >> for i=1:nvoxels(inside) >> >> for tr=1:ntrials >> >> >> ts(tr,:)=(source.avg.ori{source.inside(i)}(1,:)*source.avg.filter{source.inside(i)}*data2{condit}.trial{tr}); >> >> end >> >> datvx(i,:,:)= single_trial_time_course >> >> end >> I used a common filter with 3 different conditions, thus I think this is >> the only way I have to reconstruct the activity for one of the conditions. >> My Question is about how to apply the NAI normalization here. Can I just >> divide the output of the source reconstruction by the projected noise of the >> filter? I am tempted to do something like that >> >> datvx(i,:,:)= single_trial_time_course ./ >> repmat(noise(inside),[size(ts,1), size(ts,2)] >> >> That is, I divide the power by the noise estimate (for each voxel) in >> every trial and time-point. Could anyone tell me whether this is a correct >> way to procedure? Any other workaround? >> >> >> Thanks in advance! >> >> -- >> Marc Recasens >> Tel.: +34 639 24 15 98 >> >> _______________________________________________ >> fieldtrip mailing list >> fieldtrip at donders.ru.nl >> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip >> >> >> Dr. J.M. (Jan-Mathijs) Schoffelen >> Donders Institute for Brain, Cognition and Behaviour, >> Centre for Cognitive Neuroimaging, >> Radboud University Nijmegen, The Netherlands >> J.Schoffelen at donders.ru.nl >> Telephone: 0031-24-3614793 >> >> >> _______________________________________________ >> fieldtrip mailing listfieldtrip at donders.ru.nlhttp://mailman.science.ru.nl/mailman/listinfo/fieldtrip >> >> >> >> -- >> Marc Recasens >> Tel.: +34 639 24 15 98 >> >> >> _______________________________________________ >> fieldtrip mailing list >> fieldtrip at donders.ru.nl >> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip >> > > > > -- > Y.Harpaz > > a link to the BIU MEG lab: > http://faculty.biu.ac.il/~goldsa/index.html > > " Why, Dan," ask the people in Artificial Intelligence, "do you waste your > time conferring with those neuroscientists? They wave their hands about > information processing and worry about where it happens, and > which neurotransmitters are involved, and all those boring facts, but > they haven't a clue about the computational requirements of higher > cognitive functions." "Why," ask the neuroscientists, "do you waste your > time on the fantasies of Artificial Intelligence? They just invent > whatever machinery they want, and say unpardonably ignorant things about the > brain." The cognitive psychologists, meanwhile, are accused of concocting > models with neither biological plausibility nor proven computational powers; > the anthropologists wouldn't know a model if they saw one, and the > philosophers, as we all know, just take in each other's laundry, warning > about confusions they themselves have created, in an arena bereft of both > data and empirically testable theories. With so many idiots working on the > problem, no wonder consciousness is still a mystery.* Philosopher Daniel > Dennet, consciousness explained, pp. 225* > > -- Y.Harpaz a link to the BIU MEG lab: http://faculty.biu.ac.il/~goldsa/index.html " Why, Dan," ask the people in Artificial Intelligence, "do you waste your time conferring with those neuroscientists? They wave their hands about information processing and worry about where it happens, and which neurotransmitters are involved, and all those boring facts, but they haven't a clue about the computational requirements of higher cognitive functions." "Why," ask the neuroscientists, "do you waste your time on the fantasies of Artificial Intelligence? They just invent whatever machinery they want, and say unpardonably ignorant things about the brain." The cognitive psychologists, meanwhile, are accused of concocting models with neither biological plausibility nor proven computational powers; the anthropologists wouldn't know a model if they saw one, and the philosophers, as we all know, just take in each other's laundry, warning about confusions they themselves have created, in an arena bereft of both data and empirically testable theories. With so many idiots working on the problem, no wonder consciousness is still a mystery.* Philosopher Daniel Dennet, consciousness explained, pp. 225* -------------- next part -------------- An HTML attachment was scrubbed... URL: From batrod at gmail.com Sat Apr 9 00:23:20 2011 From: batrod at gmail.com (Rodolphe Nenert) Date: Fri, 8 Apr 2011 17:23:20 -0500 Subject: [FieldTrip] Method montecarlo unknown Message-ID: I decided to download the last Fieldtrip version today, and i tried to run a script doing some montecarlo analysis tahta was previously working. It gave me a strange error: selected 48 channels selected 25 time bins averaging over 1 frequency bins Using the 2-D layout to determine the neighbours ??? Error using ==> ft_neighbourselection at 144 Method 'montecarlo' not known Error in ==> statistics_wrapper at 241 cfg.neighbours = ft_neighbourselection(cfg,varargin{1}); Error in ==> ft_freqstatistics at 127 [stat, cfg] = statistics_wrapper(cfg, varargin{:}); Error in ==> Alpha_stats_montecarlo at 92 [stat] = ft_freqstatistics(cfg, TFRhann_base.data{var1,1:16}, TFRhann_base.data{var2,1:16}); Apparently, when it calls the neighbourselection function, it gives the cfg i specify with cfg.method = 'montecarlo'. Or it should be 'distance' or 'triangulation'. Am i missing something relative to the latest Fieldtrip version? I looked in the documentation but it seems the code hasn' t change. Best regards, Rodolphe Nenert, PhD -------------- next part -------------- An HTML attachment was scrubbed... URL: From jm.horschig at donders.ru.nl Sat Apr 9 12:41:20 2011 From: jm.horschig at donders.ru.nl (=?ISO-8859-1?Q?=22J=F6rn_M=2E_Horschig=22?=) Date: Sat, 09 Apr 2011 12:41:20 +0200 Subject: [FieldTrip] Method montecarlo unknown In-Reply-To: References: Message-ID: <4DA037D0.6070709@donders.ru.nl> Hi Rodolphe, this bug was introduced on the Friday release, since I changed something in ft_neighbourselection (my apologies). Saskia fixed this bug a few minutes ago. So please update your SVN respository, or use the version from Thursday. The new bugfix should be included in the FTP version from tomorrow on. Best, Jörn On 4/9/2011 12:23 AM, Rodolphe Nenert wrote: > I decided to download the last Fieldtrip version today, and i tried to > run a script doing some montecarlo analysis tahta was previously > working. It gave me a strange error: > > selected 48 channels > selected 25 time bins > averaging over 1 frequency bins > Using the 2-D layout to determine the neighbours > ??? Error using ==> ft_neighbourselection at 144 > Method 'montecarlo' not known > > Error in ==> statistics_wrapper at 241 > cfg.neighbours = ft_neighbourselection(cfg,varargin{1}); > > Error in ==> ft_freqstatistics at 127 > [stat, cfg] = statistics_wrapper(cfg, varargin{:}); > > Error in ==> Alpha_stats_montecarlo at 92 > [stat] = ft_freqstatistics(cfg, TFRhann_base.data{var1,1:16}, > TFRhann_base.data{var2,1:16}); > > > Apparently, when it calls the neighbourselection function, it gives > the cfg i specify with cfg.method = 'montecarlo'. Or it should be > 'distance' or 'triangulation'. > Am i missing something relative to the latest Fieldtrip version? > I looked in the documentation but it seems the code hasn' t change. > > Best regards, > > > Rodolphe Nenert, PhD > > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip -- Jörn M. Horschig PhD Student Donders Institute for Brain, Cognition and Behaviour Centre for Cognitive Neuroimaging Radboud University Nijmegen P.O. Box 9101 NL-6500 HB Nijmegen The Netherlands Contact: E-Mail: jm.horschig at donders.ru.nl Tel: +31-(0)24-36-68493 Web: http://www.ru.nl/donders Visiting address: Trigon, room 2.30 Kapitelweg 29 NL-6525 EN Nijmegen The Netherlands -------------- next part -------------- An HTML attachment was scrubbed... URL: From sherrykhan78 at gmail.com Sat Apr 9 15:41:48 2011 From: sherrykhan78 at gmail.com (Sheraz Khan) Date: Sat, 9 Apr 2011 09:41:48 -0400 Subject: [FieldTrip] Coherence Difference Message-ID: Dear fieldtrippers I am very new to fieldtrip, I need to find "Coherence (one meg channel to all MEG channel in sensor space) Differences between two groups in four condition" . Please help in pointing which FT statistics function to used and how to setup CFG for it. Thanks Regards Sheraz Khan -------------- next part -------------- An HTML attachment was scrubbed... URL: From A.Stancak at liverpool.ac.uk Sun Apr 10 21:01:28 2011 From: A.Stancak at liverpool.ac.uk (Stancak, Andrej) Date: Sun, 10 Apr 2011 20:01:28 +0100 Subject: [FieldTrip] possible designs in ft_freqstatistics Message-ID: <0813B54A9D2C494CACBD693C6A2D4D4C14761F95AF@STAFFMBX2.livad.liv.ac.uk> Dear community, we would like to use the ft_freqstatistics function to test differences between 3 conditions (within subjects, 1-way ANOVA), and also another design involving 2 groups of subjects and 2 types of visual stimulation (mixed 2x2 ANOVA). I was able to find examples for comparisons of 2 conditions and wonder if other designs are also possible and where could I find examples of "cfg.design" specification for such statistical models. Best regards Andrej Stancak Andrej Stancak, PhD. Professor for normal physiology Senior lecturer in psychology School of Psychology Eleanor Rathbone Building Bedford Street South L69 7ZA Liverpool United Kingdom Phone: 0044 0151 7946951 E-mail: a.stancak at liverpool.ac.uk (primary) stancak at lf3.cuni.cz (secondary) Office hours: Mo 10-12, Wed 10-12 From manjebrinkhuis at gmail.com Mon Apr 11 20:17:46 2011 From: manjebrinkhuis at gmail.com (Manje Brinkhuis) Date: Mon, 11 Apr 2011 20:17:46 +0200 Subject: [FieldTrip] fieldtrip Digest, Vol 5, Issue 10 In-Reply-To: References: Message-ID: Op 10 apr. 2011 12:00 schreef het volgende: > Send fieldtrip mailing list submissions to > fieldtrip at donders.ru.nl > > To subscribe or unsubscribe via the World Wide Web, visit > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > or, via email, send a message with subject or body 'help' to > fieldtrip-request at donders.ru.nl > > You can reach the person managing the list at > fieldtrip-owner at donders.ru.nl > > When replying, please edit your Subject line so it is more specific > than "Re: Contents of fieldtrip digest..." > > > Today's Topics: > > 1. Re: Method montecarlo unknown (J?rn M. Horschig) > 2. Coherence Difference (Sheraz Khan) > > > ---------------------------------------------------------------------- > > Message: 1 > Date: Sat, 09 Apr 2011 12:41:20 +0200 > From: "J?rn M. Horschig" > To: fieldtrip at donders.ru.nl > Subject: Re: [FieldTrip] Method montecarlo unknown > Message-ID: <4DA037D0.6070709 at donders.ru.nl> > Content-Type: text/plain; charset="iso-8859-1"; Format="flowed" > > Hi Rodolphe, > > this bug was introduced on the Friday release, since I changed something > in ft_neighbourselection (my apologies). Saskia fixed this bug a few > minutes ago. So please update your SVN respository, or use the version > from Thursday. The new bugfix should be included in the FTP version from > tomorrow on. > > Best, > J?rn > > On 4/9/2011 12:23 AM, Rodolphe Nenert wrote: >> I decided to download the last Fieldtrip version today, and i tried to >> run a script doing some montecarlo analysis tahta was previously >> working. It gave me a strange error: >> >> selected 48 channels >> selected 25 time bins >> averaging over 1 frequency bins >> Using the 2-D layout to determine the neighbours >> ??? Error using ==> ft_neighbourselection at 144 >> Method 'montecarlo' not known >> >> Error in ==> statistics_wrapper at 241 >> cfg.neighbours = ft_neighbourselection(cfg,varargin{1}); >> >> Error in ==> ft_freqstatistics at 127 >> [stat, cfg] = statistics_wrapper(cfg, varargin{:}); >> >> Error in ==> Alpha_stats_montecarlo at 92 >> [stat] = ft_freqstatistics(cfg, TFRhann_base.data{var1,1:16}, >> TFRhann_base.data{var2,1:16}); >> >> >> Apparently, when it calls the neighbourselection function, it gives >> the cfg i specify with cfg.method = 'montecarlo'. Or it should be >> 'distance' or 'triangulation'. >> Am i missing something relative to the latest Fieldtrip version? >> I looked in the documentation but it seems the code hasn' t change. >> >> Best regards, >> >> >> Rodolphe Nenert, PhD >> >> >> _______________________________________________ >> fieldtrip mailing list >> fieldtrip at donders.ru.nl >> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > > > -- > J?rn M. Horschig > PhD Student > Donders Institute for Brain, Cognition and Behaviour > Centre for Cognitive Neuroimaging > Radboud University Nijmegen > > P.O. Box 9101 > NL-6500 HB Nijmegen > The Netherlands > > Contact: > E-Mail: jm.horschig at donders.ru.nl > Tel: +31-(0)24-36-68493 > Web: http://www.ru.nl/donders > > Visiting address: > Trigon, room 2.30 > Kapitelweg 29 > NL-6525 EN Nijmegen > The Netherlands > > -------------- next part -------------- > An HTML attachment was scrubbed... > URL: < http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20110409/ebf855fb/attachment-0001.html > > > ------------------------------ > > Message: 2 > Date: Sat, 9 Apr 2011 09:41:48 -0400 > From: Sheraz Khan > To: fieldtrip at donders.ru.nl > Subject: [FieldTrip] Coherence Difference > Message-ID: > Content-Type: text/plain; charset="iso-8859-1" > > Dear fieldtrippers > > I am very new to fieldtrip, I need to find "Coherence (one meg channel to > all MEG channel in sensor space) Differences between two groups in four > condition" . > > Please help in pointing which FT statistics function to used and how to > setup CFG for it. > > Thanks > > Regards > > Sheraz Khan > -------------- next part -------------- > An HTML attachment was scrubbed... > URL: < http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20110409/65517355/attachment-0001.html > > > ------------------------------ > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > > End of fieldtrip Digest, Vol 5, Issue 10 > **************************************** -------------- next part -------------- An HTML attachment was scrubbed... URL: From Jan.Hirschmann at med.uni-duesseldorf.de Tue Apr 12 11:07:06 2011 From: Jan.Hirschmann at med.uni-duesseldorf.de (Jan.Hirschmann at med.uni-duesseldorf.de) Date: Tue, 12 Apr 2011 11:07:06 +0200 Subject: [FieldTrip] I think you solved the problem In-Reply-To: References: Message-ID: <72E993C35FB11743B79FF9286E5B6D8B02676142@Mail2-UKD.VMED.UKD> Dear fieldtrip experts, I have two questions regarding head model creation. As noted on this thread, the volumesegment function was updated and I tested it for our Neuromag data. The segmentation is performed, but unfortunately it is not aligned with the MRI in my case. Here is the code I am using, the fieldtrip is from 9th April 2011. %read mri mri = ft_read_mri(subject_files.fiff_mri); mri.anatomy=double(mri.anatomy); %these are the fiducials for this subject taken from the Neuromag GUI for coregistration cfg=[]; cfg.fiducial.rpa=[136.35 142.80 31.96]; cfg.fiducial.nas=[47.84 101.80 100.10]; cfg.fiducial.lpa=[139.22 146.17 162.69]; %define the head coordinate system according to CTF conventions cfg.method='fiducial'; real_mri=ft_volumerealign(cfg,mri); %segment cfg = []; cfg.template = '/data/apps/spm/spm8/templates/T1.nii'; cfg.coordinates = 'ctf'; cfg.keepintermediate = 'no'; segmentedmri = ft_volumesegment(cfg, real_mri); %plot white matter test=segmentedmri; test.anatomy=real_mri.anatomy; cfg=[]; cfg.funparameter='white'; ft_sourceplot(cfg,test); %see attached picture The other issue regards back-transformation from CTF to Neuromag coordinates, which is necessary to make the head model fit the sensors. My idea was to create an appropriate transformation matrix like this. cd /net/avidya/storage/home/jan/fieldtrip-20110409/private ctfmat=headcoordinates(nas,lpa,rpa,'ctf'); nmmat=headcoordinates(nas,lpa,rpa,'neuromag'); ctf_to_nm=nmmat/ctfmat; And then to use it on the head model to bring it back into Neuromag coordinates: %create single shell, realistic headmodel cfg = []; hdm = ft_prepare_singleshell(cfg,segmentedmri); % transformation of headmodel into Neuromag space hdm.bnd.pnt=warp_apply(ctf_to_nm,hdm.bnd.pnt,'homogeneous'); Does this survive a sanity check? Best regards and thanks a lot, Jan ________________________________ Von: fieldtrip-bounces at donders.ru.nl [mailto:fieldtrip-bounces at donders.ru.nl] Im Auftrag von Jen Whitman Gesendet: Montag, 28. Februar 2011 22:32 An: Email discussion list for the FieldTrip project Betreff: [FieldTrip] I think you solved the problem I just checked, and when I re-ran my segmentation script with the new Fieldtrip in order to use an spm8 template image, coordinates got reversed. When I take out the calls to flipdim, they look fine (see attached screenshots). That certainly explains the meaningless results I was getting! Thanks for figuring that out, Jen On Mon, Feb 28, 2011 at 12:36 PM, jan-mathijs schoffelen < jan.schoffelen at donders.ru.nl> wrote: Hi Jen, At first glance I have a comment on your script. You may need to explicitly check the alignment of your segmented volume and the original anatomy. A while a go some changes were made to ft_volumesegment, taking away the need to do the flipdim(flipdim... operations. I have posted this on the discussion list last January, but you may not have noticed. Anyway, if you now have used a recent version of FieldTrip for your segmentation both the location of your dipole grid, and the volume conductor model will not be adequately coregistered with the data, which may lead to funky results to begin with. That's most likely not related to the filetype in which the volumes are saved for later use. Best wishes, Jan-Mathijs On Feb 28, 2011, at 8:59 PM, Jen Whitman wrote: Hello Jan, When calling volumesegment, I specified 'ctf' as the coordinate system. The function I wrote to call volumesegment and prepare_singleshell for each subject and save the results is pasted below, with a couple of comments added for clarity. Over the weekend I tried specifying the coordinate system in the call to ft_volumenormalise as 'ctf' rather than 'spm', and commented out all the lines that said cfg.spmversion = 'spm8'; before calling a function. However, that created worse results, as each plot involved stripes of activation and empty voxels, suggesting that 'ctf' was not the correct coordinate system to specify. Thanks for the attached script. Looking in that the comments in that, I suspect that the solution to my problems will be to specify my filetype as nifti_img rather than nifti. I'll let you know how that goes. Jen ------------------------------------------------------------------------ ------------------------------------ % the variable subj is simply a string consisting of a subject number (e.g. 's05') which can be a folder name or part of a filename function [vol mri segmentedmri segmentedmriF]=call_volume_segment_function_spm8(subj) cfg.spmversion = 'spm8'; cfg.template = '/home/woodwardlab/spm8/templates/EPI.nii'; %cfg.template='/home/common/matlab/spm2/templates/T1.mnc'; cfg.name=[subj '_volseg']; cfg.write='yes'; cfg.smooth='no'; cfg.coordinates='ctf'; mri=read_mri([subj '/mri/' subj 'head.mri']); % made with CTF mriConverter and mriViewer software, after fiducials were marked segmentedmri = volumesegment(cfg, mri); segmentedmriF = segmentedmri; segmentedmriF.gray = flipdim(flipdim(flipdim(segmentedmriF.gray,3),2),1); segmentedmriF.white = flipdim(flipdim(flipdim(segmentedmriF.white,3),2),1); segmentedmriF.csf = flipdim(flipdim(flipdim(segmentedmriF.csf,3),2),1); segmentedmriF.transform = mri.transform; segmentedmriF.anatomy = mri.anatomy; cfg = []; cfg.spmversion = 'spm8'; vol = prepare_singleshell(cfg, segmentedmriF); eval(['save ' subj '/meg/mrisegmented.mat mri segmentedmri segmentedmriF vol']) On Sat, Feb 26, 2011 at 5:26 AM, jan-mathijs schoffelen < jan.schoffelen at donders.ru.nl> wrote: Dear Jen, I do not manage to reproduce your issue, when only focussing on the ft_volumewrite and visualization part of your pipeline. See attached script, and yet an updated version of ft_volumewrite which you need to (hopefully) draw the same conclusion as I did. Yet, I only now realize that your question may pertain to the entire pipeline. It could be that something is going wrong there. I only see now that in the part of your script of which you reported that it gave 'good' results, you specify cfg.coordinates = 'ctf' before calling ft_volumenormalise. I assume this is correct, because the coordinate system your source-reconstructed data lives in, is according to the CTF-convention, and not according to the SPM-convention. On the other hand, the template for the spatial normalization lives in the SPM-coordinate system. In order for the spatial normalization to work OK, Fieldtrip tries to convert from one coordinate system to the other (once again, this is appropriate behaviour), before doing the actual normalization. It seems that at least in the script you sent along, in the final (not working version), you specified cfg.coordinates = 'spm' prior to calling ft_volumenormalise. This is probably wrong. Another important point that should be mentioned, is that the coordinate systems in which the functional data and the anatomical data live should be the same for the ft_sourceinterpolate to make sense. In other words, if your source reconstructed images are defined on a 3D grid of positions in CTF-space, the mri.transform of your anatomy should describe a transformation from voxel to CTF-space. I think you may want to revisit step by step this part of the pipeline; I don't think the problem lies in the writing. A final possibility of course is that Mricron is misbehaving... Best, Jan-Mathijs On Feb 25, 2011, at 9:44 PM, Jen Whitman wrote: Hi Jan, I tried re-running the analysis with the new script you sent me, and the latest version of fieldtrip (since I needed ft_get_opt as well), but the spm8 images being written are still producing flawed results. It's the same problem as I mentioned briefly in my previous post. I am not getting any error messages when writing these images. Rather, my problem is that the spm8 and spm2 results from the same data ought to be identical when viewed in mricron, but they're far from it. When I use mricron to look at the results from the spm8-format images, combined across participants to create a t-image, I just get a single 'blob' spanning roughly half the brain. In contrast, when I used spm2-format previously on the same data, the t-image was much more meaningful; a posterior alpha power decrease in a set of regions corresponding to the 'task-positive network' (a network found in the results of an fMRI version of my experiment, and widely reported in the fMRI literature). This failure to replicate the spm2 results when using spm8 images from the same data leads me to suspect that something is wrong with the coordinates for spm8 format. However, after experimenting extensively with different cfg options I still haven't identified the problem. If I my structural MRIs have been saved to .mri files using CTF's MRIConverter program, which cfg options, particularly for coordinates, template images, and filetypes, should I specify before calling the ft_volumesegment, ft_prepare_singleshell, ft_sourceinterpolate, ft_volumenormalise, and ft_volumewrite functions? Or should I be calling a different set of functions now? Thanks again for your help, Jen On Thu, Feb 24, 2011 at 10:07 AM, Jen Whitman wrote: Great, thanks! I'll start the analysis with your new script today and will let you know how it works out. Jen On Thu, Feb 24, 2011 at 4:44 AM, jan-mathijs schoffelen < jan.schoffelen at donders.ru.nl> wrote: Dear Jen, I managed to reproduce your problem. The code was rather buggy and indeed ft_volumewrite did not behave as it should have. I now fixed it in the code and it should run fine now. Please find the updated file attached. It will be available on our ftp-server as of tonight. Please note that I updated the documentation, and changed the names of some of the options a bit. If you want to save your data in analyze-format, you should specify cfg.filetype = 'analyze_spm'. If you specify cfg.filetype = 'nifti', it should write out a volume to nifti-format, using SPM8. Best wishes, Jan-Mathijs On Feb 23, 2011, at 7:44 PM, Jen Whitman wrote: Dear Jan, Thanks for the quick reply. Yes, I have tried it out quite a few times now, experimenting with different settings in the cfgs. Below I'll paste the code I've been using to write images - first the code that successfully created spm2 images that produced good results, then the code used for creating nifti format images from the same data. The comments in this second part are at this point a bit of a maze of cfg options I've been changing back & forth. Any insights/suggestions regarding how to set up my cfgs to make this work would be greatly appreciated. Jen %%%%%%%% this code generated spm2-compatible images which did work (producing results that made sense). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% sourcetemp.avg.pow = (sourcetemp.avg.pow - sourcePre.avg.pow) ./ sourcePre.avg.pow; cfg = []; cfg.downsample = 2; sourcetempInt = sourceinterpolate(cfg, sourcetemp , mri); % projecting the plot onto a surface... cfg = []; cfg.coordinates = 'ctf'; cfg.template = '/home/common/matlab/spm2/templates/T1.mnc'; %this template is in MNI coordinates sourcetempIntN = volumenormalise(cfg, sourcetempInt); filename=[subj 'run' int2str(r) 'cond' int2str(cond) '_' int2str(f) 'HzWin' int2str(win) 'width750ms']; cfg=[]; cfg.parameter = 'avg.pow'; % string, describing the functional data to be processed, e.g. 'pow', 'coh' or 'nai' cfg.filename = [filename '.img']; %'testimageoutput_alphafreq'; % filename without the extension cfg.filetype = 'spm'; %'analyze', 'spm', 'vmp' or 'vmr' cfg.coordinates = 'spm'; %'spm, 'ctf' or empty for interactive (default = []) cfg.datatype = 'double'; %'float'; %'double'; %'bit1', 'uint8', 'int16', 'int32', 'float' or 'double' volumewrite(cfg, sourcetempIntN) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%% this code below hasn't worked yet... % I added cfg.spmversion = 'spm8'; % in the cfgs for the calls to ft_prepare_leadfield and ft_sourceanalysis, % and in the call to prepare_singleshell after calling volumesegment % I've also ensured that spm8 is the only spm version in my path, even in % the fieldtrip/external folder, and ensured that spm8 is installed properly % (files compiled correctly, etc..) sourcetemp.avg.pow = (sourcetemp.avg.pow - sourcePre.avg.pow) ./ sourcePre.avg.pow; filename=[subj 'run' int2str(r) 'cond' int2str(cond) '_' int2str(f) 'Hzspm8_FIXv9_Win' int2str(win) 'width750ms.img']; cfg = []; % cfg.coordinates = 'spm'; % changed for version 5 % cfg.spmversion = 'spm8'; % changed for version 5 cfg.downsample = 4; sourcetempInt = ft_sourceinterpolate(cfg, sourcetemp , mri); % projecting the plot onto a surface... cfg = []; %cfg.coordinates = 'spm'; % changed for version 5 %cfg.coordinates = 'ctf'; % changed for version 5 cfg.coordinates = 'spm'; % changed back to spm for version 9 cfg.downsample = 4; %cfg.spmversion = 'spm8'; % changed for version 6 (because this gets specified in volumewrite) cfg.template = 'Hmatrix/mask.nii.nii'; % basically equivalent to using spm8/templates/EPI.nii, except that mask.nii (produced from fmri data) has the desired voxel size % cfg.name = [filename]; % changed for version 6 %cfg.write= 'yes'; % changed for version 6 (when this was set to 'yes' there was no subsequent call to volumewrite) cfg.write= 'no'; % changed for version 6 sourcetempIntN = ft_volumenormalise(cfg, sourcetempInt); % this whole cfg and function call added for version 6 cfg=[]; % cfg.parameter = string, describing the functional data to be processed, e.g. 'pow', 'coh' or 'nai' % cfg.filename = filename without the extension % cfg.filetype = 'analyze', 'spm', 'vmp' or 'vmr' % cfg.vmpversion = 1 or 2 (default) version of the vmp-format to use % cfg.coordinates = 'spm, 'ctf' or empty for interactive (default = []) cfg.parameter='pow'; cfg.filename=filename; cfg.filetype = 'spm'; cfg.spmversion = 'SPM8'; % capitalized after first error message from vers 6 % cfg.dataformat='nifti'; % added after first error message from vers 6 % commented out after 2nd error message from vers 6 %cfg.vmpversion=2; % this is a filetype, like spm, so don't need to specify unless cfg.filetyp='vmp' cfg.coordinates='spm'; ft_volumewrite(cfg,sourcetempIntN); On Wed, Feb 23, 2011 at 7:50 AM, jan-mathijs schoffelen wrote: Dear Jen, I notice that indeed in the documentation section of ft_write_volume there is a FIXME behind nifti. Yet, nifti format seems to be supported by ft_write_volume (at least in a recent version of fieldtrip). Did you try it at all (and ran into problems) or were you held back by the FIXME statement? Could you just try it out using a recent fieldtrip function? Thanks and best wishes Jan-Mathijs On Feb 23, 2011, at 2:21 AM, Jen Whitman wrote: Hello, While writing beamformed images to spm2 format in a previous version of fieldtrip (now lost due to a computer crash), I was able to get nice-looking results; networks of brain regions consistent with existing literature. When I try to write images from the same dataset and the same analysis to spm8 format, my results (t-images computed across subjects) end up being single clusters spanning large sections of the brain (e.g. a 'blob' spanning all of one hemisphere but not the other). Unfortunately, some aspects of my planned data analyses cannot be performed on spm2 images, so I have to find a way of writing to successfully to nifti format. I just noticed that in the comments in the ft_write_volume function, which I am calling via ft_volumewrite, it says 'FIXME' next to nifti under the list of supported dataformats. Is there by any chance a patch out there for writing nifti images? Thanks! _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: misalignment.png Type: image/png Size: 105466 bytes Desc: misalignment.png URL: From jan.schoffelen at donders.ru.nl Tue Apr 12 12:10:47 2011 From: jan.schoffelen at donders.ru.nl (jan-mathijs schoffelen) Date: Tue, 12 Apr 2011 12:10:47 +0200 Subject: [FieldTrip] I think you solved the problem In-Reply-To: <72E993C35FB11743B79FF9286E5B6D8B02676142@Mail2-UKD.VMED.UKD> References: <72E993C35FB11743B79FF9286E5B6D8B02676142@Mail2-UKD.VMED.UKD> Message-ID: <7B5CA863-D143-404C-BCB9-805AA6E6E546@donders.ru.nl> Dear Jan, Apart from not being properly aligned, the segmentation looks a bit strange to me. I suspect that not everything went well here ;o). Could you try the following: specify cfg.coordsys = 'neuromag', both in your call to ft_volumerealign and in your call to ft_volumesegment. The cfg.coordinates for ft_volumesegment has to be removed (actually it is a deprecated option). The idea now is that mri-structures in fieldtrip can have a coordsys field, which allows for more transparent use of the different head coordinate system conventions. This takes away the need for intermediately coregistering the MRI in 'ctf'-convention, and would also take away your need to call headcoordinates later on. Best wishes, Jan-Mathijs On Apr 12, 2011, at 11:07 AM, wrote: > Dear fieldtrip experts, > > I have two questions regarding head model creation. As noted on this > thread, the volumesegment function was updated and I tested it for > our Neuromag data. The segmentation is performed, but unfortunately > it is not aligned with the MRI in my case. Here is the code I am > using, the fieldtrip is from 9th April 2011. > > %read mri > mri = ft_read_mri(subject_files.fiff_mri); > mri.anatomy=double(mri.anatomy); > > %these are the fiducials for this subject taken from the Neuromag > GUI for coregistration > cfg=[]; > cfg.fiducial.rpa=[136.35 142.80 31.96]; > cfg.fiducial.nas=[47.84 101.80 100.10]; > cfg.fiducial.lpa=[139.22 146.17 162.69]; > > %define the head coordinate system according to CTF conventions > cfg.method='fiducial'; > real_mri=ft_volumerealign(cfg,mri); > > %segment > cfg = []; > cfg.template = '/data/apps/spm/spm8/templates/T1.nii'; > cfg.coordinates = 'ctf'; > cfg.keepintermediate = 'no'; > segmentedmri = ft_volumesegment(cfg, real_mri); > > %plot white matter > test=segmentedmri; > test.anatomy=real_mri.anatomy; > cfg=[]; > cfg.funparameter='white'; > ft_sourceplot(cfg,test); %see attached picture > > The other issue regards back-transformation from CTF to Neuromag > coordinates, which is necessary to make the head model fit the > sensors. My idea was to create an appropriate transformation matrix > like this. > > cd /net/avidya/storage/home/jan/fieldtrip-20110409/private > ctfmat=headcoordinates(nas,lpa,rpa,'ctf'); > nmmat=headcoordinates(nas,lpa,rpa,'neuromag'); > ctf_to_nm=nmmat/ctfmat; > > > And then to use it on the head model to bring it back into Neuromag > coordinates: > > %create single shell, realistic headmodel > cfg = []; > hdm = ft_prepare_singleshell(cfg,segmentedmri); > > % transformation of headmodel into Neuromag space > hdm.bnd.pnt=warp_apply(ctf_to_nm,hdm.bnd.pnt,'homogeneous'); > > Does this survive a sanity check? > > Best regards and thanks a lot, > > Jan > > > Von: fieldtrip-bounces at donders.ru.nl [mailto:fieldtrip-bounces at donders.ru.nl > ] Im Auftrag von Jen Whitman > Gesendet: Montag, 28. Februar 2011 22:32 > An: Email discussion list for the FieldTrip project > Betreff: [FieldTrip] I think you solved the problem > > I just checked, and when I re-ran my segmentation script with the > new Fieldtrip in order to use an spm8 template image, coordinates > got reversed. When I take out the calls to flipdim, they look fine > (see attached screenshots). That certainly explains the meaningless > results I was getting! > > Thanks for figuring that out, > > Jen > > On Mon, Feb 28, 2011 at 12:36 PM, jan-mathijs schoffelen > wrote: > Hi Jen, > > At first glance I have a comment on your script. You may need to > explicitly check the alignment of your segmented volume and the > original anatomy. A while a go some changes were made to > ft_volumesegment, taking away the need to do the flipdim(flipdim... > operations. I have posted this on the discussion list last January, > but you may not have noticed. > Anyway, if you now have used a recent version of FieldTrip for your > segmentation both the location of your dipole grid, and the volume > conductor model will not be adequately coregistered with the data, > which may lead to funky results to begin with. That's most likely > not related to the filetype in which the volumes are saved for later > use. > > Best wishes, > > Jan-Mathijs > > > > On Feb 28, 2011, at 8:59 PM, Jen Whitman wrote: > > > Hello Jan, > > When calling volumesegment, I specified 'ctf' as the coordinate > system. The function I wrote to call volumesegment and > prepare_singleshell for each subject and save the results is pasted > below, with a couple of comments added for clarity. > Over the weekend I tried specifying the coordinate system in the > call to ft_volumenormalise as 'ctf' rather than 'spm', and commented > out all the lines that said cfg.spmversion = 'spm8'; before calling > a function. However, that created worse results, as each plot > involved stripes of activation and empty voxels, suggesting that > 'ctf' was not the correct coordinate system to specify. > > Thanks for the attached script. Looking in that the comments in > that, I suspect that the solution to my problems will be to specify > my filetype as nifti_img rather than nifti. I'll let you know how > that goes. > > Jen > > ------------------------------------------------------------------------------------------------------------ > % the variable subj is simply a string consisting of a subject > number (e.g. 's05') which can be a folder name or part of a filename > function [vol mri segmentedmri > segmentedmriF]=call_volume_segment_function_spm8(subj) > cfg.spmversion = 'spm8'; > cfg.template = '/home/woodwardlab/spm8/templates/EPI.nii'; > %cfg.template='/home/common/matlab/spm2/templates/T1.mnc'; > cfg.name=[subj '_volseg']; > cfg.write='yes'; > cfg.smooth='no'; > cfg.coordinates='ctf'; > mri=read_mri([subj '/mri/' subj 'head.mri']); % made with CTF > mriConverter and mriViewer software, after fiducials were marked > segmentedmri = volumesegment(cfg, mri); > segmentedmriF = segmentedmri; > segmentedmriF.gray = flipdim(flipdim(flipdim(segmentedmriF.gray,3), > 2),1); > segmentedmriF.white = flipdim(flipdim(flipdim(segmentedmriF.white,3), > 2),1); > segmentedmriF.csf = flipdim(flipdim(flipdim(segmentedmriF.csf,3), > 2),1); > segmentedmriF.transform = mri.transform; > segmentedmriF.anatomy = mri.anatomy; > cfg = []; > cfg.spmversion = 'spm8'; > vol = prepare_singleshell(cfg, segmentedmriF); > eval(['save ' subj '/meg/mrisegmented.mat mri segmentedmri > segmentedmriF vol']) > > > > On Sat, Feb 26, 2011 at 5:26 AM, jan-mathijs schoffelen > wrote: > Dear Jen, > > I do not manage to reproduce your issue, when only focussing on the > ft_volumewrite and visualization part of your pipeline. See attached > script, and yet an updated version of ft_volumewrite which you need > to (hopefully) draw the same conclusion as I did. > Yet, I only now realize that your question may pertain to the entire > pipeline. It could be that something is going wrong there. > I only see now that in the part of your script of which you reported > that it gave 'good' results, you specify cfg.coordinates = 'ctf' > before calling ft_volumenormalise. I assume this is correct, because > the coordinate system your source-reconstructed data lives in, is > according to the CTF-convention, and not according to the SPM- > convention. On the other hand, the template for the spatial > normalization lives in the SPM-coordinate system. In order for the > spatial normalization to work OK, Fieldtrip tries to convert from > one coordinate system to the other (once again, this is appropriate > behaviour), before doing the actual normalization. It seems that at > least in the script you sent along, in the final (not working > version), you specified cfg.coordinates = 'spm' prior to calling > ft_volumenormalise. This is probably wrong. > Another important point that should be mentioned, is that the > coordinate systems in which the functional data and the anatomical > data live should be the same for the ft_sourceinterpolate to make > sense. In other words, if your source reconstructed images are > defined on a 3D grid of positions in CTF-space, the mri.transform of > your anatomy should describe a transformation from voxel to CTF-space. > I think you may want to revisit step by step this part of the > pipeline; I don't think the problem lies in the writing. > A final possibility of course is that Mricron is misbehaving... > > Best, > > Jan-Mathijs > > > > > > > On Feb 25, 2011, at 9:44 PM, Jen Whitman wrote: > > > Hi Jan, > > I tried re-running the analysis with the new script you sent me, and > the latest version of fieldtrip (since I needed ft_get_opt as well), > but the spm8 images being written are still producing flawed > results. It's the same problem as I mentioned briefly in my previous > post. I am not getting any error messages when writing these images. > Rather, my problem is that the spm8 and spm2 results from the same > data ought to be identical when viewed in mricron, but they're far > from it. When I use mricron to look at the results from the spm8- > format images, combined across participants to create a t-image, I > just get a single 'blob' spanning roughly half the brain. In > contrast, when I used spm2-format previously on the same data, the t- > image was much more meaningful; a posterior alpha power decrease in > a set of regions corresponding to the 'task-positive network' (a > network found in the results of an fMRI version of my experiment, > and widely reported in the fMRI literature). > > This failure to replicate the spm2 results when using spm8 images > from the same data leads me to suspect that something is wrong with > the coordinates for spm8 format. However, after experimenting > extensively with different cfg options I still haven't identified > the problem. If I my structural MRIs have been saved to .mri files > using CTF's MRIConverter program, which cfg options, particularly > for coordinates, template images, and filetypes, should I specify > before calling the ft_volumesegment, ft_prepare_singleshell, > ft_sourceinterpolate, ft_volumenormalise, and ft_volumewrite > functions? Or should I be calling a different set of functions now? > > Thanks again for your help, > > Jen > > On Thu, Feb 24, 2011 at 10:07 AM, Jen Whitman > wrote: > Great, thanks! > > I'll start the analysis with your new script today and will let you > know how it works out. > > Jen > > On Thu, Feb 24, 2011 at 4:44 AM, jan-mathijs schoffelen > wrote: > Dear Jen, > > I managed to reproduce your problem. The code was rather buggy and > indeed ft_volumewrite did not behave as it should have. I now fixed > it in the code and it should run fine now. Please find the updated > file attached. It will be available on our ftp-server as of tonight. > Please note that I updated the documentation, and changed the names > of some of the options a bit. If you want to save your data in > analyze-format, you should specify cfg.filetype = 'analyze_spm'. If > you specify cfg.filetype = 'nifti', it should write out a volume to > nifti-format, using SPM8. > > Best wishes, > > Jan-Mathijs > > > > > > On Feb 23, 2011, at 7:44 PM, Jen Whitman wrote: > >> >> Dear Jan, >> >> Thanks for the quick reply. Yes, I have tried it out quite a few >> times now, experimenting with different settings in the cfgs. Below >> I'll paste the code I've been using to write images - first the >> code that successfully created spm2 images that produced good >> results, then the code used for creating nifti format images from >> the same data. The comments in this second part are at this point a >> bit of a maze of cfg options I've been changing back & forth. Any >> insights/suggestions regarding how to set up my cfgs to make this >> work would be greatly appreciated. >> >> Jen >> >> >> %%%%%%%% this code generated spm2-compatible images which did work >> (producing results that made sense). >> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% >> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% >> >> sourcetemp.avg.pow = (sourcetemp.avg.pow - >> sourcePre.avg.pow) ./ sourcePre.avg.pow; >> >> cfg = []; >> cfg.downsample = 2; >> sourcetempInt = sourceinterpolate(cfg, sourcetemp , mri); >> >> % projecting the plot onto a surface... >> cfg = []; >> cfg.coordinates = 'ctf'; >> cfg.template = '/home/common/matlab/spm2/templates/T1.mnc'; >> %this template is in MNI coordinates >> sourcetempIntN = volumenormalise(cfg, sourcetempInt); >> >> filename=[subj 'run' int2str(r) 'cond' int2str(cond) '_' >> int2str(f) 'HzWin' int2str(win) 'width750ms']; >> cfg=[]; >> cfg.parameter = 'avg.pow'; % string, describing the >> functional data to be processed, e.g. 'pow', 'coh' or 'nai' >> cfg.filename = [filename '.img']; >> %'testimageoutput_alphafreq'; % filename without the extension >> cfg.filetype = 'spm'; %'analyze', 'spm', 'vmp' or 'vmr' >> cfg.coordinates = 'spm'; %'spm, 'ctf' or empty for >> interactive (default = []) >> cfg.datatype = 'double'; %'float'; %'double'; %'bit1', 'uint8', >> 'int16', 'int32', 'float' or 'double' >> >> volumewrite(cfg, sourcetempIntN) >> >> >> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% >> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% >> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% >> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% >> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% >> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% >> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% >> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% >> %%%%% this code below hasn't worked yet... >> >> % I added cfg.spmversion = 'spm8'; >> % in the cfgs for the calls to ft_prepare_leadfield and >> ft_sourceanalysis, >> % and in the call to prepare_singleshell after calling volumesegment >> >> % I've also ensured that spm8 is the only spm version in my path, >> even in >> % the fieldtrip/external folder, and ensured that spm8 is installed >> properly >> % (files compiled correctly, etc..) >> >> sourcetemp.avg.pow = (sourcetemp.avg.pow - >> sourcePre.avg.pow) ./ sourcePre.avg.pow; >> >> filename=[subj 'run' int2str(r) 'cond' int2str(cond) '_' >> int2str(f) 'Hzspm8_FIXv9_Win' int2str(win) 'width750ms.img']; >> >> cfg = []; >> % cfg.coordinates = 'spm'; % changed for version 5 >> % cfg.spmversion = 'spm8'; % changed for version 5 >> cfg.downsample = 4; >> sourcetempInt = ft_sourceinterpolate(cfg, sourcetemp , mri); >> >> >> % projecting the plot onto a surface... >> cfg = []; >> %cfg.coordinates = 'spm'; % changed for version 5 >> %cfg.coordinates = 'ctf'; % changed for version 5 >> cfg.coordinates = 'spm'; % changed back to spm for version 9 >> cfg.downsample = 4; >> %cfg.spmversion = 'spm8'; % changed for version 6 (because this >> gets specified in volumewrite) >> cfg.template = 'Hmatrix/mask.nii.nii'; % basically equivalent >> to using spm8/templates/EPI.nii, except that mask.nii (produced >> from fmri data) has the desired voxel size >> % cfg.name = [filename]; % changed for version 6 >> %cfg.write= 'yes'; % changed for version 6 (when this was set >> to 'yes' there was no subsequent call to volumewrite) >> cfg.write= 'no'; % changed for version 6 >> sourcetempIntN = ft_volumenormalise(cfg, sourcetempInt); >> >> % this whole cfg and function call added for version 6 >> cfg=[]; >> % cfg.parameter = string, describing the functional data >> to be processed, e.g. 'pow', 'coh' or 'nai' >> % cfg.filename = filename without the extension >> % cfg.filetype = 'analyze', 'spm', 'vmp' or 'vmr' >> % cfg.vmpversion = 1 or 2 (default) version of the vmp-format >> to use >> % cfg.coordinates = 'spm, 'ctf' or empty for interactive >> (default = []) >> cfg.parameter='pow'; >> cfg.filename=filename; >> cfg.filetype = 'spm'; >> cfg.spmversion = 'SPM8'; % capitalized after first error >> message from vers 6 >> % cfg.dataformat='nifti'; % added after first error message from >> vers 6 >> % commented out after 2nd error >> message from vers 6 >> %cfg.vmpversion=2; % this is a filetype, like spm, so don't >> need to specify unless cfg.filetyp='vmp' >> cfg.coordinates='spm'; >> ft_volumewrite(cfg,sourcetempIntN); >> >> >> >> >> >> On Wed, Feb 23, 2011 at 7:50 AM, jan-mathijs schoffelen > > wrote: >> Dear Jen, >> >> I notice that indeed in the documentation section of >> ft_write_volume there is a FIXME behind nifti. Yet, nifti format >> seems to be supported by ft_write_volume (at least in a recent >> version of fieldtrip). Did you try it at all (and ran into >> problems) or were you held back by the FIXME statement? Could you >> just try it out using a recent fieldtrip function? >> >> Thanks and best wishes >> >> Jan-Mathijs >> >> >> >> On Feb 23, 2011, at 2:21 AM, Jen Whitman wrote: >> >> Hello, >> >> While writing beamformed images to spm2 format in a previous >> version of fieldtrip (now lost due to a computer crash), I was able >> to get nice-looking results; networks of brain regions consistent >> with existing literature. When I try to write images from the same >> dataset and the same analysis to spm8 format, my results (t-images >> computed across subjects) end up being single clusters spanning >> large sections of the brain (e.g. a 'blob' spanning all of one >> hemisphere but not the other). Unfortunately, some aspects of my >> planned data analyses cannot be performed on spm2 images, so I have >> to find a way of writing to successfully to nifti format. >> >> I just noticed that in the comments in the ft_write_volume >> function, which I am calling via ft_volumewrite, it says 'FIXME' >> next to nifti under the list of supported dataformats. Is there by >> any chance a patch out there for writing nifti images? >> >> Thanks! >> >> _______________________________________________ >> fieldtrip mailing list >> fieldtrip at donders.ru.nl >> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip >> >> Dr. J.M. (Jan-Mathijs) Schoffelen >> Donders Institute for Brain, Cognition and Behaviour, >> Centre for Cognitive Neuroimaging, >> Radboud University Nijmegen, The Netherlands >> J.Schoffelen at donders.ru.nl >> Telephone: 0031-24-3614793 >> >> _______________________________________________ >> fieldtrip mailing list >> fieldtrip at donders.ru.nl >> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip >> >> _______________________________________________ >> fieldtrip mailing list >> fieldtrip at donders.ru.nl >> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > > > Dr. J.M. (Jan-Mathijs) Schoffelen > Donders Institute for Brain, Cognition and Behaviour, > Centre for Cognitive Neuroimaging, > Radboud University Nijmegen, The Netherlands > J.Schoffelen at donders.ru.nl > Telephone: 0031-24-3614793 > > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > > Dr. J.M. (Jan-Mathijs) Schoffelen > Donders Institute for Brain, Cognition and Behaviour, > Centre for Cognitive Neuroimaging, > Radboud University Nijmegen, The Netherlands > J.Schoffelen at donders.ru.nl > Telephone: 0031-24-3614793 > > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > > Dr. J.M. (Jan-Mathijs) Schoffelen > Donders Institute for Brain, Cognition and Behaviour, > Centre for Cognitive Neuroimaging, > Radboud University Nijmegen, The Netherlands > J.Schoffelen at donders.ru.nl > Telephone: 0031-24-3614793 > > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 -------------- next part -------------- An HTML attachment was scrubbed... URL: From Jan.Hirschmann at med.uni-duesseldorf.de Tue Apr 12 13:08:55 2011 From: Jan.Hirschmann at med.uni-duesseldorf.de (Jan.Hirschmann at med.uni-duesseldorf.de) Date: Tue, 12 Apr 2011 13:08:55 +0200 Subject: [FieldTrip] I think you solved the problem In-Reply-To: <7B5CA863-D143-404C-BCB9-805AA6E6E546@donders.ru.nl> References: <72E993C35FB11743B79FF9286E5B6D8B02676142@Mail2-UKD.VMED.UKD> <7B5CA863-D143-404C-BCB9-805AA6E6E546@donders.ru.nl> Message-ID: <72E993C35FB11743B79FF9286E5B6D8B0267618F@Mail2-UKD.VMED.UKD> Dear JM, thanks a lot. I have actually just realized a few minutes ago that volumesegment and volumerealign are now supporting neuromag this way. It works just fine. I was already surprised that headcoordinates has a flag for neuromag now, and it should have occured to me that this means that also the higher-level functions were changed. Could I ask you to include this new feature in the help? I could also put an example script online if that is helpful for communicating this aspect (in case it hasn't been communicated long ago and I just missed it). Best, jan ________________________________ Von: fieldtrip-bounces at donders.ru.nl [mailto:fieldtrip-bounces at donders.ru.nl] Im Auftrag von jan-mathijs schoffelen Gesendet: Dienstag, 12. April 2011 12:11 An: Email discussion list for the FieldTrip project Betreff: Re: [FieldTrip] I think you solved the problem Dear Jan, Apart from not being properly aligned, the segmentation looks a bit strange to me. I suspect that not everything went well here ;o). Could you try the following: specify cfg.coordsys = 'neuromag', both in your call to ft_volumerealign and in your call to ft_volumesegment. The cfg.coordinates for ft_volumesegment has to be removed (actually it is a deprecated option). The idea now is that mri-structures in fieldtrip can have a coordsys field, which allows for more transparent use of the different head coordinate system conventions. This takes away the need for intermediately coregistering the MRI in 'ctf'-convention, and would also take away your need to call headcoordinates later on. Best wishes, Jan-Mathijs On Apr 12, 2011, at 11:07 AM, wrote: Dear fieldtrip experts, I have two questions regarding head model creation. As noted on this thread, the volumesegment function was updated and I tested it for our Neuromag data. The segmentation is performed, but unfortunately it is not aligned with the MRI in my case. Here is the code I am using, the fieldtrip is from 9th April 2011. %read mri mri = ft_read_mri(subject_files.fiff_mri); mri.anatomy=double(mri.anatomy); %these are the fiducials for this subject taken from the Neuromag GUI for coregistration cfg=[]; cfg.fiducial.rpa=[136.35 142.80 31.96]; cfg.fiducial.nas=[47.84 101.80 100.10]; cfg.fiducial.lpa=[139.22 146.17 162.69]; %define the head coordinate system according to CTF conventions cfg.method='fiducial'; real_mri=ft_volumerealign(cfg,mri); %segment cfg = []; cfg.template = '/data/apps/spm/spm8/templates/T1.nii'; cfg.coordinates = 'ctf'; cfg.keepintermediate = 'no'; segmentedmri = ft_volumesegment(cfg, real_mri); %plot white matter test=segmentedmri; test.anatomy=real_mri.anatomy; cfg=[]; cfg.funparameter='white'; ft_sourceplot(cfg,test); %see attached picture The other issue regards back-transformation from CTF to Neuromag coordinates, which is necessary to make the head model fit the sensors. My idea was to create an appropriate transformation matrix like this. cd /net/avidya/storage/home/jan/fieldtrip-20110409/private ctfmat=headcoordinates(nas,lpa,rpa,'ctf'); nmmat=headcoordinates(nas,lpa,rpa,'neuromag'); ctf_to_nm=nmmat/ctfmat; And then to use it on the head model to bring it back into Neuromag coordinates: %create single shell, realistic headmodel cfg = []; hdm = ft_prepare_singleshell(cfg,segmentedmri); % transformation of headmodel into Neuromag space hdm.bnd.pnt=warp_apply(ctf_to_nm,hdm.bnd.pnt,'homogeneous'); Does this survive a sanity check? Best regards and thanks a lot, Jan ________________________________ Von: fieldtrip-bounces at donders.ru.nl [mailto:fieldtrip-bounces at donders.ru.nl] Im Auftrag von Jen Whitman Gesendet: Montag, 28. Februar 2011 22:32 An: Email discussion list for the FieldTrip project Betreff: [FieldTrip] I think you solved the problem I just checked, and when I re-ran my segmentation script with the new Fieldtrip in order to use an spm8 template image, coordinates got reversed. When I take out the calls to flipdim, they look fine (see attached screenshots). That certainly explains the meaningless results I was getting! Thanks for figuring that out, Jen On Mon, Feb 28, 2011 at 12:36 PM, jan-mathijs schoffelen wrote: Hi Jen, At first glance I have a comment on your script. You may need to explicitly check the alignment of your segmented volume and the original anatomy. A while a go some changes were made to ft_volumesegment, taking away the need to do the flipdim(flipdim... operations. I have posted this on the discussion list last January, but you may not have noticed. Anyway, if you now have used a recent version of FieldTrip for your segmentation both the location of your dipole grid, and the volume conductor model will not be adequately coregistered with the data, which may lead to funky results to begin with. That's most likely not related to the filetype in which the volumes are saved for later use. Best wishes, Jan-Mathijs On Feb 28, 2011, at 8:59 PM, Jen Whitman wrote: Hello Jan, When calling volumesegment, I specified 'ctf' as the coordinate system. The function I wrote to call volumesegment and prepare_singleshell for each subject and save the results is pasted below, with a couple of comments added for clarity. Over the weekend I tried specifying the coordinate system in the call to ft_volumenormalise as 'ctf' rather than 'spm', and commented out all the lines that said cfg.spmversion = 'spm8'; before calling a function. However, that created worse results, as each plot involved stripes of activation and empty voxels, suggesting that 'ctf' was not the correct coordinate system to specify. Thanks for the attached script. Looking in that the comments in that, I suspect that the solution to my problems will be to specify my filetype as nifti_img rather than nifti. I'll let you know how that goes. Jen ------------------------------------------------------------------------ ------------------------------------ % the variable subj is simply a string consisting of a subject number (e.g. 's05') which can be a folder name or part of a filename function [vol mri segmentedmri segmentedmriF]=call_volume_segment_function_spm8(subj) cfg.spmversion = 'spm8'; cfg.template = '/home/woodwardlab/spm8/templates/EPI.nii'; %cfg.template='/home/common/matlab/spm2/templates/T1.mnc'; cfg.name=[subj '_volseg']; cfg.write='yes'; cfg.smooth='no'; cfg.coordinates='ctf'; mri=read_mri([subj '/mri/' subj 'head.mri']); % made with CTF mriConverter and mriViewer software, after fiducials were marked segmentedmri = volumesegment(cfg, mri); segmentedmriF = segmentedmri; segmentedmriF.gray = flipdim(flipdim(flipdim(segmentedmriF.gray,3),2),1); segmentedmriF.white = flipdim(flipdim(flipdim(segmentedmriF.white,3),2),1); segmentedmriF.csf = flipdim(flipdim(flipdim(segmentedmriF.csf,3),2),1); segmentedmriF.transform = mri.transform; segmentedmriF.anatomy = mri.anatomy; cfg = []; cfg.spmversion = 'spm8'; vol = prepare_singleshell(cfg, segmentedmriF); eval(['save ' subj '/meg/mrisegmented.mat mri segmentedmri segmentedmriF vol']) On Sat, Feb 26, 2011 at 5:26 AM, jan-mathijs schoffelen wrote: Dear Jen, I do not manage to reproduce your issue, when only focussing on the ft_volumewrite and visualization part of your pipeline. See attached script, and yet an updated version of ft_volumewrite which you need to (hopefully) draw the same conclusion as I did. Yet, I only now realize that your question may pertain to the entire pipeline. It could be that something is going wrong there. I only see now that in the part of your script of which you reported that it gave 'good' results, you specify cfg.coordinates = 'ctf' before calling ft_volumenormalise. I assume this is correct, because the coordinate system your source-reconstructed data lives in, is according to the CTF-convention, and not according to the SPM-convention. On the other hand, the template for the spatial normalization lives in the SPM-coordinate system. In order for the spatial normalization to work OK, Fieldtrip tries to convert from one coordinate system to the other (once again, this is appropriate behaviour), before doing the actual normalization. It seems that at least in the script you sent along, in the final (not working version), you specified cfg.coordinates = 'spm' prior to calling ft_volumenormalise. This is probably wrong. Another important point that should be mentioned, is that the coordinate systems in which the functional data and the anatomical data live should be the same for the ft_sourceinterpolate to make sense. In other words, if your source reconstructed images are defined on a 3D grid of positions in CTF-space, the mri.transform of your anatomy should describe a transformation from voxel to CTF-space. I think you may want to revisit step by step this part of the pipeline; I don't think the problem lies in the writing. A final possibility of course is that Mricron is misbehaving... Best, Jan-Mathijs On Feb 25, 2011, at 9:44 PM, Jen Whitman wrote: Hi Jan, I tried re-running the analysis with the new script you sent me, and the latest version of fieldtrip (since I needed ft_get_opt as well), but the spm8 images being written are still producing flawed results. It's the same problem as I mentioned briefly in my previous post. I am not getting any error messages when writing these images. Rather, my problem is that the spm8 and spm2 results from the same data ought to be identical when viewed in mricron, but they're far from it. When I use mricron to look at the results from the spm8-format images, combined across participants to create a t-image, I just get a single 'blob' spanning roughly half the brain. In contrast, when I used spm2-format previously on the same data, the t-image was much more meaningful; a posterior alpha power decrease in a set of regions corresponding to the 'task-positive network' (a network found in the results of an fMRI version of my experiment, and widely reported in the fMRI literature). This failure to replicate the spm2 results when using spm8 images from the same data leads me to suspect that something is wrong with the coordinates for spm8 format. However, after experimenting extensively with different cfg options I still haven't identified the problem. If I my structural MRIs have been saved to .mri files using CTF's MRIConverter program, which cfg options, particularly for coordinates, template images, and filetypes, should I specify before calling the ft_volumesegment, ft_prepare_singleshell, ft_sourceinterpolate, ft_volumenormalise, and ft_volumewrite functions? Or should I be calling a different set of functions now? Thanks again for your help, Jen On Thu, Feb 24, 2011 at 10:07 AM, Jen Whitman wrote: Great, thanks! I'll start the analysis with your new script today and will let you know how it works out. Jen On Thu, Feb 24, 2011 at 4:44 AM, jan-mathijs schoffelen wrote: Dear Jen, I managed to reproduce your problem. The code was rather buggy and indeed ft_volumewrite did not behave as it should have. I now fixed it in the code and it should run fine now. Please find the updated file attached. It will be available on our ftp-server as of tonight. Please note that I updated the documentation, and changed the names of some of the options a bit. If you want to save your data in analyze-format, you should specify cfg.filetype = 'analyze_spm'. If you specify cfg.filetype = 'nifti', it should write out a volume to nifti-format, using SPM8. Best wishes, Jan-Mathijs On Feb 23, 2011, at 7:44 PM, Jen Whitman wrote: Dear Jan, Thanks for the quick reply. Yes, I have tried it out quite a few times now, experimenting with different settings in the cfgs. Below I'll paste the code I've been using to write images - first the code that successfully created spm2 images that produced good results, then the code used for creating nifti format images from the same data. The comments in this second part are at this point a bit of a maze of cfg options I've been changing back & forth. Any insights/suggestions regarding how to set up my cfgs to make this work would be greatly appreciated. Jen %%%%%%%% this code generated spm2-compatible images which did work (producing results that made sense). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% sourcetemp.avg.pow = (sourcetemp.avg.pow - sourcePre.avg.pow) ./ sourcePre.avg.pow; cfg = []; cfg.downsample = 2; sourcetempInt = sourceinterpolate(cfg, sourcetemp , mri); % projecting the plot onto a surface... cfg = []; cfg.coordinates = 'ctf'; cfg.template = '/home/common/matlab/spm2/templates/T1.mnc'; %this template is in MNI coordinates sourcetempIntN = volumenormalise(cfg, sourcetempInt); filename=[subj 'run' int2str(r) 'cond' int2str(cond) '_' int2str(f) 'HzWin' int2str(win) 'width750ms']; cfg=[]; cfg.parameter = 'avg.pow'; % string, describing the functional data to be processed, e.g. 'pow', 'coh' or 'nai' cfg.filename = [filename '.img']; %'testimageoutput_alphafreq'; % filename without the extension cfg.filetype = 'spm'; %'analyze', 'spm', 'vmp' or 'vmr' cfg.coordinates = 'spm'; %'spm, 'ctf' or empty for interactive (default = []) cfg.datatype = 'double'; %'float'; %'double'; %'bit1', 'uint8', 'int16', 'int32', 'float' or 'double' volumewrite(cfg, sourcetempIntN) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%% this code below hasn't worked yet... % I added cfg.spmversion = 'spm8'; % in the cfgs for the calls to ft_prepare_leadfield and ft_sourceanalysis, % and in the call to prepare_singleshell after calling volumesegment % I've also ensured that spm8 is the only spm version in my path, even in % the fieldtrip/external folder, and ensured that spm8 is installed properly % (files compiled correctly, etc..) sourcetemp.avg.pow = (sourcetemp.avg.pow - sourcePre.avg.pow) ./ sourcePre.avg.pow; filename=[subj 'run' int2str(r) 'cond' int2str(cond) '_' int2str(f) 'Hzspm8_FIXv9_Win' int2str(win) 'width750ms.img']; cfg = []; % cfg.coordinates = 'spm'; % changed for version 5 % cfg.spmversion = 'spm8'; % changed for version 5 cfg.downsample = 4; sourcetempInt = ft_sourceinterpolate(cfg, sourcetemp , mri); % projecting the plot onto a surface... cfg = []; %cfg.coordinates = 'spm'; % changed for version 5 %cfg.coordinates = 'ctf'; % changed for version 5 cfg.coordinates = 'spm'; % changed back to spm for version 9 cfg.downsample = 4; %cfg.spmversion = 'spm8'; % changed for version 6 (because this gets specified in volumewrite) cfg.template = 'Hmatrix/mask.nii.nii'; % basically equivalent to using spm8/templates/EPI.nii, except that mask.nii (produced from fmri data) has the desired voxel size % cfg.name = [filename]; % changed for version 6 %cfg.write= 'yes'; % changed for version 6 (when this was set to 'yes' there was no subsequent call to volumewrite) cfg.write= 'no'; % changed for version 6 sourcetempIntN = ft_volumenormalise(cfg, sourcetempInt); % this whole cfg and function call added for version 6 cfg=[]; % cfg.parameter = string, describing the functional data to be processed, e.g. 'pow', 'coh' or 'nai' % cfg.filename = filename without the extension % cfg.filetype = 'analyze', 'spm', 'vmp' or 'vmr' % cfg.vmpversion = 1 or 2 (default) version of the vmp-format to use % cfg.coordinates = 'spm, 'ctf' or empty for interactive (default = []) cfg.parameter='pow'; cfg.filename=filename; cfg.filetype = 'spm'; cfg.spmversion = 'SPM8'; % capitalized after first error message from vers 6 % cfg.dataformat='nifti'; % added after first error message from vers 6 % commented out after 2nd error message from vers 6 %cfg.vmpversion=2; % this is a filetype, like spm, so don't need to specify unless cfg.filetyp='vmp' cfg.coordinates='spm'; ft_volumewrite(cfg,sourcetempIntN); On Wed, Feb 23, 2011 at 7:50 AM, jan-mathijs schoffelen wrote: Dear Jen, I notice that indeed in the documentation section of ft_write_volume there is a FIXME behind nifti. Yet, nifti format seems to be supported by ft_write_volume (at least in a recent version of fieldtrip). Did you try it at all (and ran into problems) or were you held back by the FIXME statement? Could you just try it out using a recent fieldtrip function? Thanks and best wishes Jan-Mathijs On Feb 23, 2011, at 2:21 AM, Jen Whitman wrote: Hello, While writing beamformed images to spm2 format in a previous version of fieldtrip (now lost due to a computer crash), I was able to get nice-looking results; networks of brain regions consistent with existing literature. When I try to write images from the same dataset and the same analysis to spm8 format, my results (t-images computed across subjects) end up being single clusters spanning large sections of the brain (e.g. a 'blob' spanning all of one hemisphere but not the other). Unfortunately, some aspects of my planned data analyses cannot be performed on spm2 images, so I have to find a way of writing to successfully to nifti format. I just noticed that in the comments in the ft_write_volume function, which I am calling via ft_volumewrite, it says 'FIXME' next to nifti under the list of supported dataformats. Is there by any chance a patch out there for writing nifti images? Thanks! _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 -------------- next part -------------- An HTML attachment was scrubbed... URL: From lieneke.janssen at student.ru.nl Tue Apr 12 14:59:46 2011 From: lieneke.janssen at student.ru.nl (Lieneke. Janssen) Date: Tue, 12 Apr 2011 14:59:46 +0200 (CEST) Subject: [FieldTrip] ft_timelockanalysis, trial selection In-Reply-To: <1126858119.313915.1302612752580.JavaMail.root@monoceros.zimbra.ru.nl> Message-ID: <812169884.314034.1302613186099.JavaMail.root@monoceros.zimbra.ru.nl> Dear fieldtrippers, Previously, I could do time-locked analysis on select trials only. Today however, I get an error (same script and similar data) which you can see below. After quite some debugging attempts, going into the other functions involved and googling a bit I think I found a little bug in the private function [data] = selfromraw(data, varargin{:}) that is called by ft_selectdata. In this private function keyval(key,varargin{:}) is not yet changed into keyval(key,varargin). See log messeage at http://code.google.com/p/fieldtrip/source/detail?spec=svn3292&r=3292. If you run keyval(key,varargin{:}) on the command line you get the error, if you run keyval(key,varargin) on the command line you don't. Hopefully, somebody can help me with this :). Thanks! Best, Lieneke --------------------------------------------------------------- ??? Error using ==> keyval the first input argument should be a cell-array or structure Error in ==> selfromraw at 3 selrpt = keyval('rpt', varargin{:}); selectrpt = ~isempty(strmatch(varargin(cellfun(@ischar, varargin)), 'rpt')); Error in ==> ft_selectdata at 508 data = selfromraw(data, 'rpt', selrpt); Error in ==> ft_timelockanalysis at 148 data = ft_selectdata(data, 'rpt', cfg.trials); Error in ==> lj_main_rfm at 255 timelock_out = ft_timelockanalysis(cfg, resampled_data); From jan.schoffelen at donders.ru.nl Tue Apr 12 15:29:44 2011 From: jan.schoffelen at donders.ru.nl (jan-mathijs schoffelen) Date: Tue, 12 Apr 2011 15:29:44 +0200 Subject: [FieldTrip] ft_timelockanalysis, trial selection In-Reply-To: <812169884.314034.1302613186099.JavaMail.root@monoceros.zimbra.ru.nl> References: <812169884.314034.1302613186099.JavaMail.root@monoceros.zimbra.ru.nl> Message-ID: <3CF7EDEF-9024-48EC-94EA-56380E5FBD44@donders.ru.nl> Dear Lieneke, Thanks for your detailed report on this bug, and sorry for the inconvenience. I fixed it now, and it should become available to you (at /home/common/matlab/fieldtrip) within the coming 15 minutes or so. If you are using an external version, it will become available on the ftp-server tonight. Best wishes, Jan-Mathijs On Apr 12, 2011, at 2:59 PM, Lieneke. Janssen wrote: > Dear fieldtrippers, > > Previously, I could do time-locked analysis on select trials only. > Today however, I get an error (same script and similar data) which > you can see below. > > After quite some debugging attempts, going into the other functions > involved and googling a bit I think I found a little bug in the > private function [data] = selfromraw(data, varargin{:}) that is > called by ft_selectdata. > > In this private function keyval(key,varargin{:}) is not yet changed > into keyval(key,varargin). See log messeage at http://code.google.com/p/fieldtrip/source/detail?spec=svn3292&r=3292 > . > > If you run keyval(key,varargin{:}) on the command line you get the > error, if you run keyval(key,varargin) on the command line you don't. > > Hopefully, somebody can help me with this :). > Thanks! > > Best, > Lieneke > > > > > > > > > --------------------------------------------------------------- > ??? Error using ==> keyval > the first input argument should be a cell-array or structure > > Error in ==> selfromraw at 3 > selrpt = keyval('rpt', varargin{:}); selectrpt = > ~isempty(strmatch(varargin(cellfun(@ischar, varargin)), 'rpt')); > > Error in ==> ft_selectdata at 508 > data = selfromraw(data, 'rpt', selrpt); > > Error in ==> ft_timelockanalysis at 148 > data = ft_selectdata(data, 'rpt', cfg.trials); > > Error in ==> lj_main_rfm at 255 > timelock_out = ft_timelockanalysis(cfg, resampled_data); > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 From jan.schoffelen at donders.ru.nl Tue Apr 12 15:38:24 2011 From: jan.schoffelen at donders.ru.nl (jan-mathijs schoffelen) Date: Tue, 12 Apr 2011 15:38:24 +0200 Subject: [FieldTrip] Fwd: ft_selectdata References: Message-ID: <9ED1C053-FFB7-4795-9AD0-BED55E003E3D@donders.ru.nl> Dear Mark, I forward your message to the list in order for other people to also benefit from it (regarding your question: at least those who can read Dutch: ;o) ). Your question relates to an error you get, when calling ft_selectdata using a variable 'Data', which I assume to be the output of ft_timelockgrandaverage. Moreover, I assume you are using a not up-to-date version of FieldTrip, because your variable 'Data' contains both and .avg-field, and in .individual-field. This makes the data-object ambiguous with respect to the 'dimord'; for the .individual-field the 'dimord' should be 'subj_chan_time', and for the .avg-field the 'dimord' should be 'chan_time'. This is why we recently changed ft_timelockgrandaverage to only output the .individual-field, if cfg.keepindividual = 'yes'; Moreover, we recently fixed a small bug related to ft_selectdata not being able to correctly deal with the 'dimord'-string 'subj'. In other words, could you please update to a recent version of FieldTrip and try again? Best wishes, Jan-Mathijs Begin forwarded message: > From: Mark Noordenbos > Date: April 12, 2011 10:37:05 AM GMT+02:00 > To: j.schoffelen at donders.ru.nl > Subject: !!!!!SPAM!!!!! ft_selectdata > > Beste Jan-Mathijs, > > Momenteel gebruik ik Fieldtrip voor het analyseren van timelocked > EEG data. Nu wil ik op basis van cluster analyse kijken of er een > verschil tussen de linker en rechter hemisfeer, maar volgens mij zit > deze optie helaas alleen in ft_sourcestatistics. Daarom probeer ik > met ft_selectdata de data te selecteren voor de linker en rechter > hemisfeer op basis van channels. Daarna heb ik de labels in de ene > dataset aangepast omdat er anders geen channels worden gevonden die > overeenkomen. > > chan_left = {'F7','F3', 'FC5','FC1','T7','C3','CP1','P7','P3','O1'}; > chan_right = {'F8','F4', 'FC6','FC2','T8','C4','CP2','P8','P4','O2'}; > Data_left = ft_selectdata(Data, 'channel', chan_left); > Data_right = ft_selectdata(Data, 'channel', chan_right); > Data_right.label= {'F3','F7','FC1','FC5','C3','CP1','P3','P7','O2'}; > > Maar met ft_selectdata krijg ik steeds de volgende foutmelding: > > ??? Attempted to access n(1); index out of bounds because numel(n)=0. > > Error in ==> dimlength at 115 > if ~all(n==n(1)) > > Error in ==> dimlength at 46 > n{k}(i) = dimlength(data, dimtok{i}, fn{k}); > > Error in ==> seloverdim at 39 > [reduceddim, fntmp] = dimlength(data); > > Error in ==> ft_selectdata at 562 > if selectrpt, data = seloverdim(data, 'rpt', selrpt, fb); end > > > Kan het kloppen dat ft_selectdata niet overweg kan met > Data.individuals want als ik dit verwijder en Data.dimord verander > in chan_time dan werkt ft_selectdata wel. > > Data bestaat uit: > > label: {30x1 cell} > fsample: 500 > avg: [30x350 double] > var: [30x350 double] > time: [1x350 double] > individual: [31x30x350 double] > dimord: 'subj_chan_time' > cfg: [1x1 struct] > > > > Wellicht doe ik iets verkeerd of is er misschien een andere (betere) > methode voor het vergelijken van hemisferen voor timelocked EEG data. > > Alvast bedankt, > Mark Noordenbos > > -- > Mark Noordenbos, MSc > > Radboud University Nijmegen > Behavioural Science Institute > > P.O. Box 9104, Room A05.36 > 6500 HE Nijmegen > The Netherlands > > Email: m.noordenbos at bsi.ru.nl > Telephone: +31 24 3612070 > Fax: +31 24 3616211 > > http://www.ru.nl Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 -------------- next part -------------- An HTML attachment was scrubbed... URL: From lieneke.janssen at student.ru.nl Tue Apr 12 16:34:32 2011 From: lieneke.janssen at student.ru.nl (Lieneke. Janssen) Date: Tue, 12 Apr 2011 16:34:32 +0200 (CEST) Subject: [FieldTrip] ft_timelockanalysis, trial selection In-Reply-To: <3CF7EDEF-9024-48EC-94EA-56380E5FBD44@donders.ru.nl> Message-ID: <1222293418.316034.1302618872718.JavaMail.root@monoceros.zimbra.ru.nl> Perfect, thanks! Tot zover m'n omslachtige trial selectie. Groetjes, Lieneke ----- "jan-mathijs schoffelen" wrote: > From: "jan-mathijs schoffelen" > To: "Email discussion list for the FieldTrip project" > Sent: Tuesday, April 12, 2011 3:29:44 PM > Subject: Re: [FieldTrip] ft_timelockanalysis, trial selection > > Dear Lieneke, > > Thanks for your detailed report on this bug, and sorry for the > inconvenience. I fixed it now, and it should become available to you > > (at /home/common/matlab/fieldtrip) within the coming 15 minutes or so. > > If you are using an external version, it will become available on the > > ftp-server tonight. > > Best wishes, > > Jan-Mathijs > > > > On Apr 12, 2011, at 2:59 PM, Lieneke. Janssen wrote: > > > Dear fieldtrippers, > > > > Previously, I could do time-locked analysis on select trials only. > > > Today however, I get an error (same script and similar data) which > > > you can see below. > > > > After quite some debugging attempts, going into the other functions > > > involved and googling a bit I think I found a little bug in the > > private function [data] = selfromraw(data, varargin{:}) that is > > called by ft_selectdata. > > > > In this private function keyval(key,varargin{:}) is not yet changed > > > into keyval(key,varargin). See log messeage at > http://code.google.com/p/fieldtrip/source/detail?spec=svn3292&r=3292 > > . > > > > If you run keyval(key,varargin{:}) on the command line you get the > > > error, if you run keyval(key,varargin) on the command line you > don't. > > > > Hopefully, somebody can help me with this :). > > Thanks! > > > > Best, > > Lieneke > > > > > > > > > > > > > > > > > > --------------------------------------------------------------- > > ??? Error using ==> keyval > > the first input argument should be a cell-array or structure > > > > Error in ==> selfromraw at 3 > > selrpt = keyval('rpt', varargin{:}); selectrpt = > > ~isempty(strmatch(varargin(cellfun(@ischar, varargin)), 'rpt')); > > > > Error in ==> ft_selectdata at 508 > > data = selfromraw(data, 'rpt', selrpt); > > > > Error in ==> ft_timelockanalysis at 148 > > data = ft_selectdata(data, 'rpt', cfg.trials); > > > > Error in ==> lj_main_rfm at 255 > > timelock_out = ft_timelockanalysis(cfg, resampled_data); > > _______________________________________________ > > fieldtrip mailing list > > fieldtrip at donders.ru.nl > > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > > Dr. J.M. (Jan-Mathijs) Schoffelen > Donders Institute for Brain, Cognition and Behaviour, > Centre for Cognitive Neuroimaging, > Radboud University Nijmegen, The Netherlands > J.Schoffelen at donders.ru.nl > Telephone: 0031-24-3614793 > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip From sherrykhan78 at gmail.com Tue Apr 12 20:06:32 2011 From: sherrykhan78 at gmail.com (Sheraz Khan) Date: Tue, 12 Apr 2011 14:06:32 -0400 Subject: [FieldTrip] Postdoctoral Fellowship: Multimodal Neuroimaging -MGH/Harvard Medical School Message-ID: Postdoctoral Fellowship: Multimodal Neuroimaging -MGH/Harvard Medical School Job Description A postdoctoral position is available with the TRANSCEND Research Program ( www.transcendresearch.org) at the Martinos Center for Biomedical Imaging in Charlestown, MA (www.martinos.org) which is affiliated with the Massachusetts General Hospital, Harvard Medical School and MIT. We are seeking a candidate with a strong basis in magnetic resonance imaging. Emphasis will be on MRI (DTI, spectroscopy, morphometry, ASL as well as resting state fMRI), and on co-registering MEG with MRI. This position will involve analysis of existing multimodal imaging data and collection of new data. The emphasis of the postdoctoral fellowship will be analysis of existing datasets with secondary activity in piloting data for new studies. It will involve working closely with a multidisciplinary team and with children, and will also involve some research oriented analysis of data collected for clinical purposes. After initial phase-in, ample opportunity will also be provided to the candidate to self-explore and lead research. Datasets to be analyzed include: MRI (including DTI and 1H-spectroscopy) and MEG data on 6-12 and teenage matched autism spectrum and control subjects with phenotyping data MRI data ( (morphometry, DTI, spectroscopy) plus laboratory and phenotyping data) on 70 children with autism plus epilepsy and/or mitochondrial dysfunction, along with one or more overnight EEGs on each patient data from children ages 2-10 with and without autism. Overall objectives: To perform multimodal analyses of research and clinical research data, to develop new approaches for performing these analyses, and to design pipelines for data analysis. To write papers and grants which will be high priorities all along the way and will be actively supported by senior faculty. To take advantage of the world class faculty and facilities of the Martinos Center for Biomedical Imaging to perform the above activities to their maximal potential. The program’s emphasis is on pathophysiologically grounded brain research and application of advanced imaging acquisition and analysis techniques to neurological and sensory aspects of autism spectrum disorders. Requirements: Candidates must have PhD in neuroscience, physics, biomedical engineering, electrical engineering, computer science or other related fields. Prior experience in MRI analysis is required. Experience with EEG will be an added advantage. Salary will be consistent with Massachusetts General Hospital, Harvard Medical School policies for Postdoctoral trainees and will range between $45,000 to $55,000 depending upon qualifications and experience. Compensation also includes full staff benefits, including health insurance, and vacation time. Contact: Interested applicants may send a CV and statement of interest addressing background and specific pertinence of the candidate’s interest to Dr. Martha R. Herbert at mherbert1 at partners.org and cc transcend at partners.org. Applications will be considered until the position is filled. -------------- next part -------------- An HTML attachment was scrubbed... URL: From Jan.Hirschmann at med.uni-duesseldorf.de Tue Apr 12 20:49:10 2011 From: Jan.Hirschmann at med.uni-duesseldorf.de (Jan.Hirschmann at med.uni-duesseldorf.de) Date: Tue, 12 Apr 2011 20:49:10 +0200 Subject: [FieldTrip] I think you solved the problem In-Reply-To: <7B5CA863-D143-404C-BCB9-805AA6E6E546@donders.ru.nl> References: <72E993C35FB11743B79FF9286E5B6D8B02676142@Mail2-UKD.VMED.UKD> <7B5CA863-D143-404C-BCB9-805AA6E6E546@donders.ru.nl> Message-ID: <72E993C35FB11743B79FF9286E5B6D8B02676264@Mail2-UKD.VMED.UKD> Dear Jan-Mathijs, sorry, I think I was a bit too enthusiastic when I said everything worked out wonderfully. It worked only once. After an afternoon of confusion I concluded that on my first try I must have misspelled cfg.coordsys='neuromag' on my calls to ft_volumerealign and ft_volumesegment. In fact, the segmentation looks really bad with these settings. What works for me is written underneath: mri = ft_read_mri('....fif'); hdr=ft_read_header('...fif'); mri.anatomy=double(mri.anatomy); %this is taken from the Neuromag GUI for MRI-MEG Integration cfg=[]; cfg.fiducial.rpa=[136.35 142.80 31.96]; cfg.fiducial.nas=[47.84 101.80 100.10]; cfg.fiducial.lpa=[139.22 146.17 162.69]; %go from neuromag voxel to neuromag head coordinates cfg.coordsys='neuromag'; cfg.method='fiducial'; real_mri=ft_volumerealign(cfg,mri); %taking real_mri with its coordsys field will not work, so I take mri mri.transform=real_mri.transform; cfg = []; cfg.keepintermediate = 'no'; cfg.write = 'no'; segmentedmri = ft_volumesegment(cfg, mri); Before segmentation the function shows some kind of brain (pic 1). When segmentation is done the segmented brain looks good (pic 2) but the brain does not fit the helmet (pic 3). It is looking at its feet as if it dropped some pocket change. Do you know what is going on? Thanks, jan ________________________________ Von: fieldtrip-bounces at donders.ru.nl [mailto:fieldtrip-bounces at donders.ru.nl] Im Auftrag von jan-mathijs schoffelen Gesendet: Dienstag, 12. April 2011 12:11 An: Email discussion list for the FieldTrip project Betreff: Re: [FieldTrip] I think you solved the problem Dear Jan, Apart from not being properly aligned, the segmentation looks a bit strange to me. I suspect that not everything went well here ;o). Could you try the following: specify cfg.coordsys = 'neuromag', both in your call to ft_volumerealign and in your call to ft_volumesegment. The cfg.coordinates for ft_volumesegment has to be removed (actually it is a deprecated option). The idea now is that mri-structures in fieldtrip can have a coordsys field, which allows for more transparent use of the different head coordinate system conventions. This takes away the need for intermediately coregistering the MRI in 'ctf'-convention, and would also take away your need to call headcoordinates later on. Best wishes, Jan-Mathijs On Apr 12, 2011, at 11:07 AM, < Jan.Hirschmann at med.uni-duesseldorf.de> wrote: Dear fieldtrip experts, I have two questions regarding head model creation. As noted on this thread, the volumesegment function was updated and I tested it for our Neuromag data. The segmentation is performed, but unfortunately it is not aligned with the MRI in my case. Here is the code I am using, the fieldtrip is from 9th April 2011. %read mri mri = ft_read_mri(subject_files.fiff_mri); mri.anatomy=double(mri.anatomy); %these are the fiducials for this subject taken from the Neuromag GUI for coregistration cfg=[]; cfg.fiducial.rpa=[136.35 142.80 31.96]; cfg.fiducial.nas=[47.84 101.80 100.10]; cfg.fiducial.lpa=[139.22 146.17 162.69]; %define the head coordinate system according to CTF conventions cfg.method='fiducial'; real_mri=ft_volumerealign(cfg,mri); %segment cfg = []; cfg.template = '/data/apps/spm/spm8/templates/T1.nii'; cfg.coordinates = 'ctf'; cfg.keepintermediate = 'no'; segmentedmri = ft_volumesegment(cfg, real_mri); %plot white matter test=segmentedmri; test.anatomy=real_mri.anatomy; cfg=[]; cfg.funparameter='white'; ft_sourceplot(cfg,test); %see attached picture The other issue regards back-transformation from CTF to Neuromag coordinates, which is necessary to make the head model fit the sensors. My idea was to create an appropriate transformation matrix like this. cd /net/avidya/storage/home/jan/fieldtrip-20110409/private ctfmat=headcoordinates(nas,lpa,rpa,'ctf'); nmmat=headcoordinates(nas,lpa,rpa,'neuromag'); ctf_to_nm=nmmat/ctfmat; And then to use it on the head model to bring it back into Neuromag coordinates: %create single shell, realistic headmodel cfg = []; hdm = ft_prepare_singleshell(cfg,segmentedmri); % transformation of headmodel into Neuromag space hdm.bnd.pnt=warp_apply(ctf_to_nm,hdm.bnd.pnt,'homogeneous'); Does this survive a sanity check? Best regards and thanks a lot, Jan ________________________________ Von: fieldtrip-bounces at donders.ru.nl [ mailto:fieldtrip-bounces at donders.ru.nl] Im Auftrag von Jen Whitman Gesendet: Montag, 28. Februar 2011 22:32 An: Email discussion list for the FieldTrip project Betreff: [FieldTrip] I think you solved the problem I just checked, and when I re-ran my segmentation script with the new Fieldtrip in order to use an spm8 template image, coordinates got reversed. When I take out the calls to flipdim, they look fine (see attached screenshots). That certainly explains the meaningless results I was getting! Thanks for figuring that out, Jen On Mon, Feb 28, 2011 at 12:36 PM, jan-mathijs schoffelen < jan.schoffelen at donders.ru.nl> wrote: Hi Jen, At first glance I have a comment on your script. You may need to explicitly check the alignment of your segmented volume and the original anatomy. A while a go some changes were made to ft_volumesegment, taking away the need to do the flipdim(flipdim... operations. I have posted this on the discussion list last January, but you may not have noticed. Anyway, if you now have used a recent version of FieldTrip for your segmentation both the location of your dipole grid, and the volume conductor model will not be adequately coregistered with the data, which may lead to funky results to begin with. That's most likely not related to the filetype in which the volumes are saved for later use. Best wishes, Jan-Mathijs On Feb 28, 2011, at 8:59 PM, Jen Whitman wrote: Hello Jan, When calling volumesegment, I specified 'ctf' as the coordinate system. The function I wrote to call volumesegment and prepare_singleshell for each subject and save the results is pasted below, with a couple of comments added for clarity. Over the weekend I tried specifying the coordinate system in the call to ft_volumenormalise as 'ctf' rather than 'spm', and commented out all the lines that said cfg.spmversion = 'spm8'; before calling a function. However, that created worse results, as each plot involved stripes of activation and empty voxels, suggesting that 'ctf' was not the correct coordinate system to specify. Thanks for the attached script. Looking in that the comments in that, I suspect that the solution to my problems will be to specify my filetype as nifti_img rather than nifti. I'll let you know how that goes. Jen ------------------------------------------------------------------------ ------------------------------------ % the variable subj is simply a string consisting of a subject number (e.g. 's05') which can be a folder name or part of a filename function [vol mri segmentedmri segmentedmriF]=call_volume_segment_function_spm8(subj) cfg.spmversion = 'spm8'; cfg.template = '/home/woodwardlab/spm8/templates/EPI.nii'; %cfg.template='/home/common/matlab/spm2/templates/T1.mnc'; cfg.name=[subj '_volseg']; cfg.write='yes'; cfg.smooth='no'; cfg.coordinates='ctf'; mri=read_mri([subj '/mri/' subj 'head.mri']); % made with CTF mriConverter and mriViewer software, after fiducials were marked segmentedmri = volumesegment(cfg, mri); segmentedmriF = segmentedmri; segmentedmriF.gray = flipdim(flipdim(flipdim(segmentedmriF.gray,3),2),1); segmentedmriF.white = flipdim(flipdim(flipdim(segmentedmriF.white,3),2),1); segmentedmriF.csf = flipdim(flipdim(flipdim(segmentedmriF.csf,3),2),1); segmentedmriF.transform = mri.transform; segmentedmriF.anatomy = mri.anatomy; cfg = []; cfg.spmversion = 'spm8'; vol = prepare_singleshell(cfg, segmentedmriF); eval(['save ' subj '/meg/mrisegmented.mat mri segmentedmri segmentedmriF vol']) On Sat, Feb 26, 2011 at 5:26 AM, jan-mathijs schoffelen < jan.schoffelen at donders.ru.nl> wrote: Dear Jen, I do not manage to reproduce your issue, when only focussing on the ft_volumewrite and visualization part of your pipeline. See attached script, and yet an updated version of ft_volumewrite which you need to (hopefully) draw the same conclusion as I did. Yet, I only now realize that your question may pertain to the entire pipeline. It could be that something is going wrong there. I only see now that in the part of your script of which you reported that it gave 'good' results, you specify cfg.coordinates = 'ctf' before calling ft_volumenormalise. I assume this is correct, because the coordinate system your source-reconstructed data lives in, is according to the CTF-convention, and not according to the SPM-convention. On the other hand, the template for the spatial normalization lives in the SPM-coordinate system. In order for the spatial normalization to work OK, Fieldtrip tries to convert from one coordinate system to the other (once again, this is appropriate behaviour), before doing the actual normalization. It seems that at least in the script you sent along, in the final (not working version), you specified cfg.coordinates = 'spm' prior to calling ft_volumenormalise. This is probably wrong. Another important point that should be mentioned, is that the coordinate systems in which the functional data and the anatomical data live should be the same for the ft_sourceinterpolate to make sense. In other words, if your source reconstructed images are defined on a 3D grid of positions in CTF-space, the mri.transform of your anatomy should describe a transformation from voxel to CTF-space. I think you may want to revisit step by step this part of the pipeline; I don't think the problem lies in the writing. A final possibility of course is that Mricron is misbehaving... Best, Jan-Mathijs On Feb 25, 2011, at 9:44 PM, Jen Whitman wrote: Hi Jan, I tried re-running the analysis with the new script you sent me, and the latest version of fieldtrip (since I needed ft_get_opt as well), but the spm8 images being written are still producing flawed results. It's the same problem as I mentioned briefly in my previous post. I am not getting any error messages when writing these images. Rather, my problem is that the spm8 and spm2 results from the same data ought to be identical when viewed in mricron, but they're far from it. When I use mricron to look at the results from the spm8-format images, combined across participants to create a t-image, I just get a single 'blob' spanning roughly half the brain. In contrast, when I used spm2-format previously on the same data, the t-image was much more meaningful; a posterior alpha power decrease in a set of regions corresponding to the 'task-positive network' (a network found in the results of an fMRI version of my experiment, and widely reported in the fMRI literature). This failure to replicate the spm2 results when using spm8 images from the same data leads me to suspect that something is wrong with the coordinates for spm8 format. However, after experimenting extensively with different cfg options I still haven't identified the problem. If I my structural MRIs have been saved to .mri files using CTF's MRIConverter program, which cfg options, particularly for coordinates, template images, and filetypes, should I specify before calling the ft_volumesegment, ft_prepare_singleshell, ft_sourceinterpolate, ft_volumenormalise, and ft_volumewrite functions? Or should I be calling a different set of functions now? Thanks again for your help, Jen On Thu, Feb 24, 2011 at 10:07 AM, Jen Whitman wrote: Great, thanks! I'll start the analysis with your new script today and will let you know how it works out. Jen On Thu, Feb 24, 2011 at 4:44 AM, jan-mathijs schoffelen < jan.schoffelen at donders.ru.nl> wrote: Dear Jen, I managed to reproduce your problem. The code was rather buggy and indeed ft_volumewrite did not behave as it should have. I now fixed it in the code and it should run fine now. Please find the updated file attached. It will be available on our ftp-server as of tonight. Please note that I updated the documentation, and changed the names of some of the options a bit. If you want to save your data in analyze-format, you should specify cfg.filetype = 'analyze_spm'. If you specify cfg.filetype = 'nifti', it should write out a volume to nifti-format, using SPM8. Best wishes, Jan-Mathijs On Feb 23, 2011, at 7:44 PM, Jen Whitman wrote: Dear Jan, Thanks for the quick reply. Yes, I have tried it out quite a few times now, experimenting with different settings in the cfgs. Below I'll paste the code I've been using to write images - first the code that successfully created spm2 images that produced good results, then the code used for creating nifti format images from the same data. The comments in this second part are at this point a bit of a maze of cfg options I've been changing back & forth. Any insights/suggestions regarding how to set up my cfgs to make this work would be greatly appreciated. Jen %%%%%%%% this code generated spm2-compatible images which did work (producing results that made sense). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% sourcetemp.avg.pow = (sourcetemp.avg.pow - sourcePre.avg.pow) ./ sourcePre.avg.pow; cfg = []; cfg.downsample = 2; sourcetempInt = sourceinterpolate(cfg, sourcetemp , mri); % projecting the plot onto a surface... cfg = []; cfg.coordinates = 'ctf'; cfg.template = '/home/common/matlab/spm2/templates/T1.mnc'; %this template is in MNI coordinates sourcetempIntN = volumenormalise(cfg, sourcetempInt); filename=[subj 'run' int2str(r) 'cond' int2str(cond) '_' int2str(f) 'HzWin' int2str(win) 'width750ms']; cfg=[]; cfg.parameter = 'avg.pow'; % string, describing the functional data to be processed, e.g. 'pow', 'coh' or 'nai' cfg.filename = [filename '.img']; %'testimageoutput_alphafreq'; % filename without the extension cfg.filetype = 'spm'; %'analyze', 'spm', 'vmp' or 'vmr' cfg.coordinates = 'spm'; %'spm, 'ctf' or empty for interactive (default = []) cfg.datatype = 'double'; %'float'; %'double'; %'bit1', 'uint8', 'int16', 'int32', 'float' or 'double' volumewrite(cfg, sourcetempIntN) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%% this code below hasn't worked yet... % I added cfg.spmversion = 'spm8'; % in the cfgs for the calls to ft_prepare_leadfield and ft_sourceanalysis, % and in the call to prepare_singleshell after calling volumesegment % I've also ensured that spm8 is the only spm version in my path, even in % the fieldtrip/external folder, and ensured that spm8 is installed properly % (files compiled correctly, etc..) sourcetemp.avg.pow = (sourcetemp.avg.pow - sourcePre.avg.pow) ./ sourcePre.avg.pow; filename=[subj 'run' int2str(r) 'cond' int2str(cond) '_' int2str(f) 'Hzspm8_FIXv9_Win' int2str(win) 'width750ms.img']; cfg = []; % cfg.coordinates = 'spm'; % changed for version 5 % cfg.spmversion = 'spm8'; % changed for version 5 cfg.downsample = 4; sourcetempInt = ft_sourceinterpolate(cfg, sourcetemp , mri); % projecting the plot onto a surface... cfg = []; %cfg.coordinates = 'spm'; % changed for version 5 %cfg.coordinates = 'ctf'; % changed for version 5 cfg.coordinates = 'spm'; % changed back to spm for version 9 cfg.downsample = 4; %cfg.spmversion = 'spm8'; % changed for version 6 (because this gets specified in volumewrite) cfg.template = 'Hmatrix/mask.nii.nii'; % basically equivalent to using spm8/templates/EPI.nii, except that mask.nii (produced from fmri data) has the desired voxel size % cfg.name = [filename]; % changed for version 6 %cfg.write= 'yes'; % changed for version 6 (when this was set to 'yes' there was no subsequent call to volumewrite) cfg.write= 'no'; % changed for version 6 sourcetempIntN = ft_volumenormalise(cfg, sourcetempInt); % this whole cfg and function call added for version 6 cfg=[]; % cfg.parameter = string, describing the functional data to be processed, e.g. 'pow', 'coh' or 'nai' % cfg.filename = filename without the extension % cfg.filetype = 'analyze', 'spm', 'vmp' or 'vmr' % cfg.vmpversion = 1 or 2 (default) version of the vmp-format to use % cfg.coordinates = 'spm, 'ctf' or empty for interactive (default = []) cfg.parameter='pow'; cfg.filename=filename; cfg.filetype = 'spm'; cfg.spmversion = 'SPM8'; % capitalized after first error message from vers 6 % cfg.dataformat='nifti'; % added after first error message from vers 6 % commented out after 2nd error message from vers 6 %cfg.vmpversion=2; % this is a filetype, like spm, so don't need to specify unless cfg.filetyp='vmp' cfg.coordinates='spm'; ft_volumewrite(cfg,sourcetempIntN); On Wed, Feb 23, 2011 at 7:50 AM, jan-mathijs schoffelen wrote: Dear Jen, I notice that indeed in the documentation section of ft_write_volume there is a FIXME behind nifti. Yet, nifti format seems to be supported by ft_write_volume (at least in a recent version of fieldtrip). Did you try it at all (and ran into problems) or were you held back by the FIXME statement? Could you just try it out using a recent fieldtrip function? Thanks and best wishes Jan-Mathijs On Feb 23, 2011, at 2:21 AM, Jen Whitman wrote: Hello, While writing beamformed images to spm2 format in a previous version of fieldtrip (now lost due to a computer crash), I was able to get nice-looking results; networks of brain regions consistent with existing literature. When I try to write images from the same dataset and the same analysis to spm8 format, my results (t-images computed across subjects) end up being single clusters spanning large sections of the brain (e.g. a 'blob' spanning all of one hemisphere but not the other). Unfortunately, some aspects of my planned data analyses cannot be performed on spm2 images, so I have to find a way of writing to successfully to nifti format. I just noticed that in the comments in the ft_write_volume function, which I am calling via ft_volumewrite, it says 'FIXME' next to nifti under the list of supported dataformats. Is there by any chance a patch out there for writing nifti images? Thanks! _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: pic1.png Type: image/png Size: 62738 bytes Desc: pic1.png URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: pic2.png Type: image/png Size: 106479 bytes Desc: pic2.png URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: pic3.png Type: image/png Size: 55419 bytes Desc: pic3.png URL: From jan.schoffelen at donders.ru.nl Tue Apr 12 21:17:59 2011 From: jan.schoffelen at donders.ru.nl (jan-mathijs schoffelen) Date: Tue, 12 Apr 2011 21:17:59 +0200 Subject: [FieldTrip] I think you solved the problem In-Reply-To: <72E993C35FB11743B79FF9286E5B6D8B02676264@Mail2-UKD.VMED.UKD> References: <72E993C35FB11743B79FF9286E5B6D8B02676142@Mail2-UKD.VMED.UKD> <7B5CA863-D143-404C-BCB9-805AA6E6E546@donders.ru.nl> <72E993C35FB11743B79FF9286E5B6D8B02676264@Mail2-UKD.VMED.UKD> Message-ID: Dear Jan, I suspect that your mri, as it comes out of ft_read_mri is already coregistered in neuromag space. After your realignment and after replacing mri.transform with real_mri.transform, the coordinate axes in your pic1 look strange. This I think causes the 'dropped pocket change'. What happens if you skip the ft_volumerealign step and call ft_volumesegment directly on the mri (with cfg.coordsys = 'neuromag', or, for what it's worth, without cfg.coordsys; in this case you will be able to verify the coordinate system)? Alternatively, if this doesn't work, could you replace mri.transform by eye(4) prior to calling ft_volumerealign and ft_volumesegment (both with cfg.coordsys = 'neuromag' and no further tampering with transformation matrices?). Thanks JM On Apr 12, 2011, at 8:49 PM, wrote: > Dear Jan-Mathijs, > > sorry, I think I was a bit too enthusiastic when I said everything > worked out wonderfully. It worked only once. After an afternoon of > confusion I concluded that on my first try I must have misspelled > cfg.coordsys=’neuromag’ on my calls to ft_volumerealign and > ft_volumesegment. In fact, the segmentation looks really bad with > these settings. What works for me is written underneath: > > mri = ft_read_mri('….fif'); > hdr=ft_read_header('…fif'); > mri.anatomy=double(mri.anatomy); > > %this is taken from the Neuromag GUI for MRI-MEG Integration > cfg=[]; > cfg.fiducial.rpa=[136.35 142.80 31.96]; > cfg.fiducial.nas=[47.84 101.80 100.10]; > cfg.fiducial.lpa=[139.22 146.17 162.69]; > > %go from neuromag voxel to neuromag head coordinates > cfg.coordsys='neuromag'; > cfg.method='fiducial'; > real_mri=ft_volumerealign(cfg,mri); > > %taking real_mri with its coordsys field will not work, so I take mri > mri.transform=real_mri.transform; > > cfg = []; > cfg.keepintermediate = 'no'; > cfg.write = 'no'; > segmentedmri = ft_volumesegment(cfg, mri); > > > Before segmentation the function shows some kind of brain (pic 1). > When segmentation is done the segmented brain looks good (pic 2) but > the brain does not fit the helmet (pic 3). It is looking at its feet > as if it dropped some pocket change. Do you know what is going on? > > Thanks, > jan > > Von: fieldtrip-bounces at donders.ru.nl [mailto:fieldtrip-bounces at donders.ru.nl > ] Im Auftrag von jan-mathijs schoffelen > Gesendet: Dienstag, 12. April 2011 12:11 > An: Email discussion list for the FieldTrip project > Betreff: Re: [FieldTrip] I think you solved the problem > > Dear Jan, > > Apart from not being properly aligned, the segmentation looks a bit > strange to me. I suspect that not everything went well here ;o). > Could you try the following: > > specify cfg.coordsys = 'neuromag', both in your call to > ft_volumerealign and in your call to ft_volumesegment. The > cfg.coordinates for ft_volumesegment has to be removed (actually it > is a deprecated option). The idea now is that mri-structures in > fieldtrip can have a coordsys field, which allows for more > transparent use of the different head coordinate system conventions. > This takes away the need for intermediately coregistering the MRI in > 'ctf'-convention, and would also take away your need to call > headcoordinates later on. > > Best wishes, > > Jan-Mathijs > > > On Apr 12, 2011, at 11:07 AM, duesseldorf.de> wrote: > > > Dear fieldtrip experts, > > I have two questions regarding head model creation. As noted on this > thread, the volumesegment function was updated and I tested it for > our Neuromag data. The segmentation is performed, but unfortunately > it is not aligned with the MRI in my case. Here is the code I am > using, the fieldtrip is from 9th April 2011. > > %read mri > mri = ft_read_mri(subject_files.fiff_mri); > mri.anatomy=double(mri.anatomy); > > %these are the fiducials for this subject taken from the Neuromag > GUI for coregistration > cfg=[]; > cfg.fiducial.rpa=[136.35 142.80 31.96]; > cfg.fiducial.nas=[47.84 101.80 100.10]; > cfg.fiducial.lpa=[139.22 146.17 162.69]; > > %define the head coordinate system according to CTF conventions > cfg.method='fiducial'; > real_mri=ft_volumerealign(cfg,mri); > > %segment > cfg = []; > cfg.template = '/data/apps/spm/spm8/templates/T1.nii'; > cfg.coordinates = 'ctf'; > cfg.keepintermediate = 'no'; > segmentedmri = ft_volumesegment(cfg, real_mri); > > %plot white matter > test=segmentedmri; > test.anatomy=real_mri.anatomy; > cfg=[]; > cfg.funparameter='white'; > ft_sourceplot(cfg,test); %see attached picture > > The other issue regards back-transformation from CTF to Neuromag > coordinates, which is necessary to make the head model fit the > sensors. My idea was to create an appropriate transformation matrix > like this. > > cd /net/avidya/storage/home/jan/fieldtrip-20110409/private > ctfmat=headcoordinates(nas,lpa,rpa,'ctf'); > nmmat=headcoordinates(nas,lpa,rpa,'neuromag'); > ctf_to_nm=nmmat/ctfmat; > > > And then to use it on the head model to bring it back into Neuromag > coordinates: > > %create single shell, realistic headmodel > cfg = []; > hdm = ft_prepare_singleshell(cfg,segmentedmri); > > % transformation of headmodel into Neuromag space > hdm.bnd.pnt=warp_apply(ctf_to_nm,hdm.bnd.pnt,'homogeneous'); > > Does this survive a sanity check? > > Best regards and thanks a lot, > > Jan > > > Von: fieldtrip-bounces at donders.ru.nl [mailto:fieldtrip-bounces at donders.ru.nl > ] Im Auftrag von Jen Whitman > Gesendet: Montag, 28. Februar 2011 22:32 > An: Email discussion list for the FieldTrip project > Betreff: [FieldTrip] I think you solved the problem > > I just checked, and when I re-ran my segmentation script with the > new Fieldtrip in order to use an spm8 template image, coordinates > got reversed. When I take out the calls to flipdim, they look fine > (see attached screenshots). That certainly explains the meaningless > results I was getting! > > Thanks for figuring that out, > > Jen > > On Mon, Feb 28, 2011 at 12:36 PM, jan-mathijs schoffelen > wrote: > Hi Jen, > > At first glance I have a comment on your script. You may need to > explicitly check the alignment of your segmented volume and the > original anatomy. A while a go some changes were made to > ft_volumesegment, taking away the need to do the flipdim(flipdim... > operations. I have posted this on the discussion list last January, > but you may not have noticed. > Anyway, if you now have used a recent version of FieldTrip for your > segmentation both the location of your dipole grid, and the volume > conductor model will not be adequately coregistered with the data, > which may lead to funky results to begin with. That's most likely > not related to the filetype in which the volumes are saved for later > use. > > Best wishes, > > Jan-Mathijs > > > > On Feb 28, 2011, at 8:59 PM, Jen Whitman wrote: > > > > Hello Jan, > > When calling volumesegment, I specified 'ctf' as the coordinate > system. The function I wrote to call volumesegment and > prepare_singleshell for each subject and save the results is pasted > below, with a couple of comments added for clarity. > Over the weekend I tried specifying the coordinate system in the > call to ft_volumenormalise as 'ctf' rather than 'spm', and commented > out all the lines that said cfg.spmversion = 'spm8'; before calling > a function. However, that created worse results, as each plot > involved stripes of activation and empty voxels, suggesting that > 'ctf' was not the correct coordinate system to specify. > > Thanks for the attached script. Looking in that the comments in > that, I suspect that the solution to my problems will be to specify > my filetype as nifti_img rather than nifti. I'll let you know how > that goes. > > Jen > > ------------------------------------------------------------------------------------------------------------ > % the variable subj is simply a string consisting of a subject > number (e.g. 's05') which can be a folder name or part of a filename > function [vol mri segmentedmri > segmentedmriF]=call_volume_segment_function_spm8(subj) > cfg.spmversion = 'spm8'; > cfg.template = '/home/woodwardlab/spm8/templates/EPI.nii'; > %cfg.template='/home/common/matlab/spm2/templates/T1.mnc'; > cfg.name=[subj '_volseg']; > cfg.write='yes'; > cfg.smooth='no'; > cfg.coordinates='ctf'; > mri=read_mri([subj '/mri/' subj 'head.mri']); % made with CTF > mriConverter and mriViewer software, after fiducials were marked > segmentedmri = volumesegment(cfg, mri); > segmentedmriF = segmentedmri; > segmentedmriF.gray = flipdim(flipdim(flipdim(segmentedmriF.gray,3), > 2),1); > segmentedmriF.white = flipdim(flipdim(flipdim(segmentedmriF.white,3), > 2),1); > segmentedmriF.csf = flipdim(flipdim(flipdim(segmentedmriF.csf,3), > 2),1); > segmentedmriF.transform = mri.transform; > segmentedmriF.anatomy = mri.anatomy; > cfg = []; > cfg.spmversion = 'spm8'; > vol = prepare_singleshell(cfg, segmentedmriF); > eval(['save ' subj '/meg/mrisegmented.mat mri segmentedmri > segmentedmriF vol']) > > > > > On Sat, Feb 26, 2011 at 5:26 AM, jan-mathijs schoffelen > wrote: > Dear Jen, > > I do not manage to reproduce your issue, when only focussing on the > ft_volumewrite and visualization part of your pipeline. See attached > script, and yet an updated version of ft_volumewrite which you need > to (hopefully) draw the same conclusion as I did. > Yet, I only now realize that your question may pertain to the entire > pipeline. It could be that something is going wrong there. > I only see now that in the part of your script of which you reported > that it gave 'good' results, you specify cfg.coordinates = 'ctf' > before calling ft_volumenormalise. I assume this is correct, because > the coordinate system your source-reconstructed data lives in, is > according to the CTF-convention, and not according to the SPM- > convention. On the other hand, the template for the spatial > normalization lives in the SPM-coordinate system. In order for the > spatial normalization to work OK, Fieldtrip tries to convert from > one coordinate system to the other (once again, this is appropriate > behaviour), before doing the actual normalization. It seems that at > least in the script you sent along, in the final (not working > version), you specified cfg.coordinates = 'spm' prior to calling > ft_volumenormalise. This is probably wrong. > Another important point that should be mentioned, is that the > coordinate systems in which the functional data and the anatomical > data live should be the same for the ft_sourceinterpolate to make > sense. In other words, if your source reconstructed images are > defined on a 3D grid of positions in CTF-space, the mri.transform of > your anatomy should describe a transformation from voxel to CTF-space. > I think you may want to revisit step by step this part of the > pipeline; I don't think the problem lies in the writing. > A final possibility of course is that Mricron is misbehaving... > > Best, > > Jan-Mathijs > > > > > > > On Feb 25, 2011, at 9:44 PM, Jen Whitman wrote: > > > > Hi Jan, > > I tried re-running the analysis with the new script you sent me, and > the latest version of fieldtrip (since I needed ft_get_opt as well), > but the spm8 images being written are still producing flawed > results. It's the same problem as I mentioned briefly in my previous > post. I am not getting any error messages when writing these images. > Rather, my problem is that the spm8 and spm2 results from the same > data ought to be identical when viewed in mricron, but they're far > from it. When I use mricron to look at the results from the spm8- > format images, combined across participants to create a t-image, I > just get a single 'blob' spanning roughly half the brain. In > contrast, when I used spm2-format previously on the same data, the t- > image was much more meaningful; a posterior alpha power decrease in > a set of regions corresponding to the 'task-positive network' (a > network found in the results of an fMRI version of my experiment, > and widely reported in the fMRI literature). > > This failure to replicate the spm2 results when using spm8 images > from the same data leads me to suspect that something is wrong with > the coordinates for spm8 format. However, after experimenting > extensively with different cfg options I still haven't identified > the problem. If I my structural MRIs have been saved to .mri files > using CTF's MRIConverter program, which cfg options, particularly > for coordinates, template images, and filetypes, should I specify > before calling the ft_volumesegment, ft_prepare_singleshell, > ft_sourceinterpolate, ft_volumenormalise, and ft_volumewrite > functions? Or should I be calling a different set of functions now? > > Thanks again for your help, > > Jen > > On Thu, Feb 24, 2011 at 10:07 AM, Jen Whitman > wrote: > Great, thanks! > > I'll start the analysis with your new script today and will let you > know how it works out. > > Jen > > On Thu, Feb 24, 2011 at 4:44 AM, jan-mathijs schoffelen > wrote: > Dear Jen, > > I managed to reproduce your problem. The code was rather buggy and > indeed ft_volumewrite did not behave as it should have. I now fixed > it in the code and it should run fine now. Please find the updated > file attached. It will be available on our ftp-server as of tonight. > Please note that I updated the documentation, and changed the names > of some of the options a bit. If you want to save your data in > analyze-format, you should specify cfg.filetype = 'analyze_spm'. If > you specify cfg.filetype = 'nifti', it should write out a volume to > nifti-format, using SPM8. > > Best wishes, > > Jan-Mathijs > > > > > > On Feb 23, 2011, at 7:44 PM, Jen Whitman wrote: > >> >> Dear Jan, >> >> Thanks for the quick reply. Yes, I have tried it out quite a few >> times now, experimenting with different settings in the cfgs. Below >> I'll paste the code I've been using to write images - first the >> code that successfully created spm2 images that produced good >> results, then the code used for creating nifti format images from >> the same data. The comments in this second part are at this point a >> bit of a maze of cfg options I've been changing back & forth. Any >> insights/suggestions regarding how to set up my cfgs to make this >> work would be greatly appreciated. >> >> Jen >> >> >> %%%%%%%% this code generated spm2-compatible images which did work >> (producing results that made sense). >> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% >> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% >> >> sourcetemp.avg.pow = (sourcetemp.avg.pow - >> sourcePre.avg.pow) ./ sourcePre.avg.pow; >> >> cfg = []; >> cfg.downsample = 2; >> sourcetempInt = sourceinterpolate(cfg, sourcetemp , mri); >> >> % projecting the plot onto a surface... >> cfg = []; >> cfg.coordinates = 'ctf'; >> cfg.template = '/home/common/matlab/spm2/templates/T1.mnc'; >> %this template is in MNI coordinates >> sourcetempIntN = volumenormalise(cfg, sourcetempInt); >> >> filename=[subj 'run' int2str(r) 'cond' int2str(cond) '_' >> int2str(f) 'HzWin' int2str(win) 'width750ms']; >> cfg=[]; >> cfg.parameter = 'avg.pow'; % string, describing the >> functional data to be processed, e.g. 'pow', 'coh' or 'nai' >> cfg.filename = [filename '.img']; >> %'testimageoutput_alphafreq'; % filename without the extension >> cfg.filetype = 'spm'; %'analyze', 'spm', 'vmp' or 'vmr' >> cfg.coordinates = 'spm'; %'spm, 'ctf' or empty for >> interactive (default = []) >> cfg.datatype = 'double'; %'float'; %'double'; %'bit1', 'uint8', >> 'int16', 'int32', 'float' or 'double' >> >> volumewrite(cfg, sourcetempIntN) >> >> >> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% >> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% >> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% >> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% >> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% >> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% >> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% >> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% >> %%%%% this code below hasn't worked yet... >> >> % I added cfg.spmversion = 'spm8'; >> % in the cfgs for the calls to ft_prepare_leadfield and >> ft_sourceanalysis, >> % and in the call to prepare_singleshell after calling volumesegment >> >> % I've also ensured that spm8 is the only spm version in my path, >> even in >> % the fieldtrip/external folder, and ensured that spm8 is installed >> properly >> % (files compiled correctly, etc..) >> >> sourcetemp.avg.pow = (sourcetemp.avg.pow - >> sourcePre.avg.pow) ./ sourcePre.avg.pow; >> >> filename=[subj 'run' int2str(r) 'cond' int2str(cond) '_' >> int2str(f) 'Hzspm8_FIXv9_Win' int2str(win) 'width750ms.img']; >> >> cfg = []; >> % cfg.coordinates = 'spm'; % changed for version 5 >> % cfg.spmversion = 'spm8'; % changed for version 5 >> cfg.downsample = 4; >> sourcetempInt = ft_sourceinterpolate(cfg, sourcetemp , mri); >> >> >> % projecting the plot onto a surface... >> cfg = []; >> %cfg.coordinates = 'spm'; % changed for version 5 >> %cfg.coordinates = 'ctf'; % changed for version 5 >> cfg.coordinates = 'spm'; % changed back to spm for version 9 >> cfg.downsample = 4; >> %cfg.spmversion = 'spm8'; % changed for version 6 (because this >> gets specified in volumewrite) >> cfg.template = 'Hmatrix/mask.nii.nii'; % basically equivalent >> to using spm8/templates/EPI.nii, except that mask.nii (produced >> from fmri data) has the desired voxel size >> % cfg.name = [filename]; % changed for version 6 >> %cfg.write= 'yes'; % changed for version 6 (when this was set >> to 'yes' there was no subsequent call to volumewrite) >> cfg.write= 'no'; % changed for version 6 >> sourcetempIntN = ft_volumenormalise(cfg, sourcetempInt); >> >> % this whole cfg and function call added for version 6 >> cfg=[]; >> % cfg.parameter = string, describing the functional data >> to be processed, e.g. 'pow', 'coh' or 'nai' >> % cfg.filename = filename without the extension >> % cfg.filetype = 'analyze', 'spm', 'vmp' or 'vmr' >> % cfg.vmpversion = 1 or 2 (default) version of the vmp-format >> to use >> % cfg.coordinates = 'spm, 'ctf' or empty for interactive >> (default = []) >> cfg.parameter='pow'; >> cfg.filename=filename; >> cfg.filetype = 'spm'; >> cfg.spmversion = 'SPM8'; % capitalized after first error >> message from vers 6 >> % cfg.dataformat='nifti'; % added after first error message from >> vers 6 >> % commented out after 2nd error >> message from vers 6 >> %cfg.vmpversion=2; % this is a filetype, like spm, so don't >> need to specify unless cfg.filetyp='vmp' >> cfg.coordinates='spm'; >> ft_volumewrite(cfg,sourcetempIntN); >> >> >> >> >> >> >> On Wed, Feb 23, 2011 at 7:50 AM, jan-mathijs schoffelen > > wrote: >> Dear Jen, >> >> I notice that indeed in the documentation section of >> ft_write_volume there is a FIXME behind nifti. Yet, nifti format >> seems to be supported by ft_write_volume (at least in a recent >> version of fieldtrip). Did you try it at all (and ran into >> problems) or were you held back by the FIXME statement? Could you >> just try it out using a recent fieldtrip function? >> >> Thanks and best wishes >> >> Jan-Mathijs >> >> >> >> On Feb 23, 2011, at 2:21 AM, Jen Whitman wrote: >> >> Hello, >> >> While writing beamformed images to spm2 format in a previous >> version of fieldtrip (now lost due to a computer crash), I was able >> to get nice-looking results; networks of brain regions consistent >> with existing literature. When I try to write images from the same >> dataset and the same analysis to spm8 format, my results (t-images >> computed across subjects) end up being single clusters spanning >> large sections of the brain (e.g. a 'blob' spanning all of one >> hemisphere but not the other). Unfortunately, some aspects of my >> planned data analyses cannot be performed on spm2 images, so I have >> to find a way of writing to successfully to nifti format. >> >> I just noticed that in the comments in the ft_write_volume >> function, which I am calling via ft_volumewrite, it says 'FIXME' >> next to nifti under the list of supported dataformats. Is there by >> any chance a patch out there for writing nifti images? >> >> Thanks! >> >> _______________________________________________ >> fieldtrip mailing list >> fieldtrip at donders.ru.nl >> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip >> >> Dr. J.M. (Jan-Mathijs) Schoffelen >> Donders Institute for Brain, Cognition and Behaviour, >> Centre for Cognitive Neuroimaging, >> Radboud University Nijmegen, The Netherlands >> J.Schoffelen at donders.ru.nl >> Telephone: 0031-24-3614793 >> >> _______________________________________________ >> fieldtrip mailing list >> fieldtrip at donders.ru.nl >> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip >> >> _______________________________________________ >> fieldtrip mailing list >> fieldtrip at donders.ru.nl >> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > > > Dr. J.M. (Jan-Mathijs) Schoffelen > Donders Institute for Brain, Cognition and Behaviour, > Centre for Cognitive Neuroimaging, > Radboud University Nijmegen, The Netherlands > J.Schoffelen at donders.ru.nl > Telephone: 0031-24-3614793 > > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > > Dr. J.M. (Jan-Mathijs) Schoffelen > Donders Institute for Brain, Cognition and Behaviour, > Centre for Cognitive Neuroimaging, > Radboud University Nijmegen, The Netherlands > J.Schoffelen at donders.ru.nl > Telephone: 0031-24-3614793 > > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > > Dr. J.M. (Jan-Mathijs) Schoffelen > Donders Institute for Brain, Cognition and Behaviour, > Centre for Cognitive Neuroimaging, > Radboud University Nijmegen, The Netherlands > J.Schoffelen at donders.ru.nl > Telephone: 0031-24-3614793 > > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > > Dr. J.M. (Jan-Mathijs) Schoffelen > Donders Institute for Brain, Cognition and Behaviour, > Centre for Cognitive Neuroimaging, > Radboud University Nijmegen, The Netherlands > J.Schoffelen at donders.ru.nl > Telephone: 0031-24-3614793 > > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 -------------- next part -------------- An HTML attachment was scrubbed... URL: From Jan.Hirschmann at med.uni-duesseldorf.de Wed Apr 13 14:31:58 2011 From: Jan.Hirschmann at med.uni-duesseldorf.de (Jan.Hirschmann at med.uni-duesseldorf.de) Date: Wed, 13 Apr 2011 14:31:58 +0200 Subject: [FieldTrip] I think you solved the problem In-Reply-To: References: <72E993C35FB11743B79FF9286E5B6D8B02676142@Mail2-UKD.VMED.UKD><7B5CA863-D143-404C-BCB9-805AA6E6E546@donders.ru.nl><72E993C35FB11743B79FF9286E5B6D8B02676264@Mail2-UKD.VMED.UKD> Message-ID: <72E993C35FB11743B79FF9286E5B6D8B026763B8@Mail2-UKD.VMED.UKD> Dear Jan-Mathijs, I think we solved the problem. Everthing is like you said in the first place. ft_volumerealign and ft_volumesegment should be called with cfg.coordsys='neuromag'. The only thing that was wrong is that for the voxel coordinates read from the Neuromag GUI x and y should be swapped. For anyone interested I attach a script that is meant to be easy-to-use for beginners. Thank you very much for your time! ________________________________ Von: fieldtrip-bounces at donders.ru.nl [mailto:fieldtrip-bounces at donders.ru.nl] Im Auftrag von jan-mathijs schoffelen Gesendet: Dienstag, 12. April 2011 21:18 An: Email discussion list for the FieldTrip project Betreff: Re: [FieldTrip] I think you solved the problem Dear Jan, I suspect that your mri, as it comes out of ft_read_mri is already coregistered in neuromag space. After your realignment and after replacing mri.transform with real_mri.transform, the coordinate axes in your pic1 look strange. This I think causes the 'dropped pocket change'. What happens if you skip the ft_volumerealign step and call ft_volumesegment directly on the mri (with cfg.coordsys = 'neuromag', or, for what it's worth, without cfg.coordsys; in this case you will be able to verify the coordinate system)? Alternatively, if this doesn't work, could you replace mri.transform by eye(4) prior to calling ft_volumerealign and ft_volumesegment (both with cfg.coordsys = 'neuromag' and no further tampering with transformation matrices?). Thanks JM On Apr 12, 2011, at 8:49 PM, < Jan.Hirschmann at med.uni-duesseldorf.de> wrote: Dear Jan-Mathijs, sorry, I think I was a bit too enthusiastic when I said everything worked out wonderfully. It worked only once. After an afternoon of confusion I concluded that on my first try I must have misspelled cfg.coordsys='neuromag' on my calls to ft_volumerealign and ft_volumesegment. In fact, the segmentation looks really bad with these settings. What works for me is written underneath: mri = ft_read_mri('....fif'); hdr=ft_read_header('...fif'); mri.anatomy=double(mri.anatomy); %this is taken from the Neuromag GUI for MRI-MEG Integration cfg=[]; cfg.fiducial.rpa=[136.35 142.80 31.96]; cfg.fiducial.nas=[47.84 101.80 100.10]; cfg.fiducial.lpa=[139.22 146.17 162.69]; %go from neuromag voxel to neuromag head coordinates cfg.coordsys='neuromag'; cfg.method='fiducial'; real_mri=ft_volumerealign(cfg,mri); %taking real_mri with its coordsys field will not work, so I take mri mri.transform=real_mri.transform; cfg = []; cfg.keepintermediate = 'no'; cfg.write = 'no'; segmentedmri = ft_volumesegment(cfg, mri); Before segmentation the function shows some kind of brain (pic 1). When segmentation is done the segmented brain looks good (pic 2) but the brain does not fit the helmet (pic 3). It is looking at its feet as if it dropped some pocket change. Do you know what is going on? Thanks, jan ________________________________ Von: fieldtrip-bounces at donders.ru.nl [ mailto:fieldtrip-bounces at donders.ru.nl] Im Auftrag von jan-mathijs schoffelen Gesendet: Dienstag, 12. April 2011 12:11 An: Email discussion list for the FieldTrip project Betreff: Re: [FieldTrip] I think you solved the problem Dear Jan, Apart from not being properly aligned, the segmentation looks a bit strange to me. I suspect that not everything went well here ;o). Could you try the following: specify cfg.coordsys = 'neuromag', both in your call to ft_volumerealign and in your call to ft_volumesegment. The cfg.coordinates for ft_volumesegment has to be removed (actually it is a deprecated option). The idea now is that mri-structures in fieldtrip can have a coordsys field, which allows for more transparent use of the different head coordinate system conventions. This takes away the need for intermediately coregistering the MRI in 'ctf'-convention, and would also take away your need to call headcoordinates later on. Best wishes, Jan-Mathijs On Apr 12, 2011, at 11:07 AM, < Jan.Hirschmann at med.uni-duesseldorf.de> wrote: Dear fieldtrip experts, I have two questions regarding head model creation. As noted on this thread, the volumesegment function was updated and I tested it for our Neuromag data. The segmentation is performed, but unfortunately it is not aligned with the MRI in my case. Here is the code I am using, the fieldtrip is from 9th April 2011. %read mri mri = ft_read_mri(subject_files.fiff_mri); mri.anatomy=double(mri.anatomy); %these are the fiducials for this subject taken from the Neuromag GUI for coregistration cfg=[]; cfg.fiducial.rpa=[136.35 142.80 31.96]; cfg.fiducial.nas=[47.84 101.80 100.10]; cfg.fiducial.lpa=[139.22 146.17 162.69]; %define the head coordinate system according to CTF conventions cfg.method='fiducial'; real_mri=ft_volumerealign(cfg,mri); %segment cfg = []; cfg.template = '/data/apps/spm/spm8/templates/T1.nii'; cfg.coordinates = 'ctf'; cfg.keepintermediate = 'no'; segmentedmri = ft_volumesegment(cfg, real_mri); %plot white matter test=segmentedmri; test.anatomy=real_mri.anatomy; cfg=[]; cfg.funparameter='white'; ft_sourceplot(cfg,test); %see attached picture The other issue regards back-transformation from CTF to Neuromag coordinates, which is necessary to make the head model fit the sensors. My idea was to create an appropriate transformation matrix like this. cd /net/avidya/storage/home/jan/fieldtrip-20110409/private ctfmat=headcoordinates(nas,lpa,rpa,'ctf'); nmmat=headcoordinates(nas,lpa,rpa,'neuromag'); ctf_to_nm=nmmat/ctfmat; And then to use it on the head model to bring it back into Neuromag coordinates: %create single shell, realistic headmodel cfg = []; hdm = ft_prepare_singleshell(cfg,segmentedmri); % transformation of headmodel into Neuromag space hdm.bnd.pnt=warp_apply(ctf_to_nm,hdm.bnd.pnt,'homogeneous'); Does this survive a sanity check? Best regards and thanks a lot, Jan ________________________________ Von: fieldtrip-bounces at donders.ru.nl [ mailto:fieldtrip-bounces at donders.ru.nl] Im Auftrag von Jen Whitman Gesendet: Montag, 28. Februar 2011 22:32 An: Email discussion list for the FieldTrip project Betreff: [FieldTrip] I think you solved the problem I just checked, and when I re-ran my segmentation script with the new Fieldtrip in order to use an spm8 template image, coordinates got reversed. When I take out the calls to flipdim, they look fine (see attached screenshots). That certainly explains the meaningless results I was getting! Thanks for figuring that out, Jen On Mon, Feb 28, 2011 at 12:36 PM, jan-mathijs schoffelen < jan.schoffelen at donders.ru.nl> wrote: Hi Jen, At first glance I have a comment on your script. You may need to explicitly check the alignment of your segmented volume and the original anatomy. A while a go some changes were made to ft_volumesegment, taking away the need to do the flipdim(flipdim... operations. I have posted this on the discussion list last January, but you may not have noticed. Anyway, if you now have used a recent version of FieldTrip for your segmentation both the location of your dipole grid, and the volume conductor model will not be adequately coregistered with the data, which may lead to funky results to begin with. That's most likely not related to the filetype in which the volumes are saved for later use. Best wishes, Jan-Mathijs On Feb 28, 2011, at 8:59 PM, Jen Whitman wrote: Hello Jan, When calling volumesegment, I specified 'ctf' as the coordinate system. The function I wrote to call volumesegment and prepare_singleshell for each subject and save the results is pasted below, with a couple of comments added for clarity. Over the weekend I tried specifying the coordinate system in the call to ft_volumenormalise as 'ctf' rather than 'spm', and commented out all the lines that said cfg.spmversion = 'spm8'; before calling a function. However, that created worse results, as each plot involved stripes of activation and empty voxels, suggesting that 'ctf' was not the correct coordinate system to specify. Thanks for the attached script. Looking in that the comments in that, I suspect that the solution to my problems will be to specify my filetype as nifti_img rather than nifti. I'll let you know how that goes. Jen ------------------------------------------------------------------------ ------------------------------------ % the variable subj is simply a string consisting of a subject number (e.g. 's05') which can be a folder name or part of a filename function [vol mri segmentedmri segmentedmriF]=call_volume_segment_function_spm8(subj) cfg.spmversion = 'spm8'; cfg.template = '/home/woodwardlab/spm8/templates/EPI.nii'; %cfg.template='/home/common/matlab/spm2/templates/T1.mnc'; cfg.name=[subj '_volseg']; cfg.write='yes'; cfg.smooth='no'; cfg.coordinates='ctf'; mri=read_mri([subj '/mri/' subj 'head.mri']); % made with CTF mriConverter and mriViewer software, after fiducials were marked segmentedmri = volumesegment(cfg, mri); segmentedmriF = segmentedmri; segmentedmriF.gray = flipdim(flipdim(flipdim(segmentedmriF.gray,3),2),1); segmentedmriF.white = flipdim(flipdim(flipdim(segmentedmriF.white,3),2),1); segmentedmriF.csf = flipdim(flipdim(flipdim(segmentedmriF.csf,3),2),1); segmentedmriF.transform = mri.transform; segmentedmriF.anatomy = mri.anatomy; cfg = []; cfg.spmversion = 'spm8'; vol = prepare_singleshell(cfg, segmentedmriF); eval(['save ' subj '/meg/mrisegmented.mat mri segmentedmri segmentedmriF vol']) On Sat, Feb 26, 2011 at 5:26 AM, jan-mathijs schoffelen < jan.schoffelen at donders.ru.nl> wrote: Dear Jen, I do not manage to reproduce your issue, when only focussing on the ft_volumewrite and visualization part of your pipeline. See attached script, and yet an updated version of ft_volumewrite which you need to (hopefully) draw the same conclusion as I did. Yet, I only now realize that your question may pertain to the entire pipeline. It could be that something is going wrong there. I only see now that in the part of your script of which you reported that it gave 'good' results, you specify cfg.coordinates = 'ctf' before calling ft_volumenormalise. I assume this is correct, because the coordinate system your source-reconstructed data lives in, is according to the CTF-convention, and not according to the SPM-convention. On the other hand, the template for the spatial normalization lives in the SPM-coordinate system. In order for the spatial normalization to work OK, Fieldtrip tries to convert from one coordinate system to the other (once again, this is appropriate behaviour), before doing the actual normalization. It seems that at least in the script you sent along, in the final (not working version), you specified cfg.coordinates = 'spm' prior to calling ft_volumenormalise. This is probably wrong. Another important point that should be mentioned, is that the coordinate systems in which the functional data and the anatomical data live should be the same for the ft_sourceinterpolate to make sense. In other words, if your source reconstructed images are defined on a 3D grid of positions in CTF-space, the mri.transform of your anatomy should describe a transformation from voxel to CTF-space. I think you may want to revisit step by step this part of the pipeline; I don't think the problem lies in the writing. A final possibility of course is that Mricron is misbehaving... Best, Jan-Mathijs On Feb 25, 2011, at 9:44 PM, Jen Whitman wrote: Hi Jan, I tried re-running the analysis with the new script you sent me, and the latest version of fieldtrip (since I needed ft_get_opt as well), but the spm8 images being written are still producing flawed results. It's the same problem as I mentioned briefly in my previous post. I am not getting any error messages when writing these images. Rather, my problem is that the spm8 and spm2 results from the same data ought to be identical when viewed in mricron, but they're far from it. When I use mricron to look at the results from the spm8-format images, combined across participants to create a t-image, I just get a single 'blob' spanning roughly half the brain. In contrast, when I used spm2-format previously on the same data, the t-image was much more meaningful; a posterior alpha power decrease in a set of regions corresponding to the 'task-positive network' (a network found in the results of an fMRI version of my experiment, and widely reported in the fMRI literature). This failure to replicate the spm2 results when using spm8 images from the same data leads me to suspect that something is wrong with the coordinates for spm8 format. However, after experimenting extensively with different cfg options I still haven't identified the problem. If I my structural MRIs have been saved to .mri files using CTF's MRIConverter program, which cfg options, particularly for coordinates, template images, and filetypes, should I specify before calling the ft_volumesegment, ft_prepare_singleshell, ft_sourceinterpolate, ft_volumenormalise, and ft_volumewrite functions? Or should I be calling a different set of functions now? Thanks again for your help, Jen On Thu, Feb 24, 2011 at 10:07 AM, Jen Whitman wrote: Great, thanks! I'll start the analysis with your new script today and will let you know how it works out. Jen On Thu, Feb 24, 2011 at 4:44 AM, jan-mathijs schoffelen < jan.schoffelen at donders.ru.nl> wrote: Dear Jen, I managed to reproduce your problem. The code was rather buggy and indeed ft_volumewrite did not behave as it should have. I now fixed it in the code and it should run fine now. Please find the updated file attached. It will be available on our ftp-server as of tonight. Please note that I updated the documentation, and changed the names of some of the options a bit. If you want to save your data in analyze-format, you should specify cfg.filetype = 'analyze_spm'. If you specify cfg.filetype = 'nifti', it should write out a volume to nifti-format, using SPM8. Best wishes, Jan-Mathijs On Feb 23, 2011, at 7:44 PM, Jen Whitman wrote: Dear Jan, Thanks for the quick reply. Yes, I have tried it out quite a few times now, experimenting with different settings in the cfgs. Below I'll paste the code I've been using to write images - first the code that successfully created spm2 images that produced good results, then the code used for creating nifti format images from the same data. The comments in this second part are at this point a bit of a maze of cfg options I've been changing back & forth. Any insights/suggestions regarding how to set up my cfgs to make this work would be greatly appreciated. Jen %%%%%%%% this code generated spm2-compatible images which did work (producing results that made sense). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% sourcetemp.avg.pow = (sourcetemp.avg.pow - sourcePre.avg.pow) ./ sourcePre.avg.pow; cfg = []; cfg.downsample = 2; sourcetempInt = sourceinterpolate(cfg, sourcetemp , mri); % projecting the plot onto a surface... cfg = []; cfg.coordinates = 'ctf'; cfg.template = '/home/common/matlab/spm2/templates/T1.mnc'; %this template is in MNI coordinates sourcetempIntN = volumenormalise(cfg, sourcetempInt); filename=[subj 'run' int2str(r) 'cond' int2str(cond) '_' int2str(f) 'HzWin' int2str(win) 'width750ms']; cfg=[]; cfg.parameter = 'avg.pow'; % string, describing the functional data to be processed, e.g. 'pow', 'coh' or 'nai' cfg.filename = [filename '.img']; %'testimageoutput_alphafreq'; % filename without the extension cfg.filetype = 'spm'; %'analyze', 'spm', 'vmp' or 'vmr' cfg.coordinates = 'spm'; %'spm, 'ctf' or empty for interactive (default = []) cfg.datatype = 'double'; %'float'; %'double'; %'bit1', 'uint8', 'int16', 'int32', 'float' or 'double' volumewrite(cfg, sourcetempIntN) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%% this code below hasn't worked yet... % I added cfg.spmversion = 'spm8'; % in the cfgs for the calls to ft_prepare_leadfield and ft_sourceanalysis, % and in the call to prepare_singleshell after calling volumesegment % I've also ensured that spm8 is the only spm version in my path, even in % the fieldtrip/external folder, and ensured that spm8 is installed properly % (files compiled correctly, etc..) sourcetemp.avg.pow = (sourcetemp.avg.pow - sourcePre.avg.pow) ./ sourcePre.avg.pow; filename=[subj 'run' int2str(r) 'cond' int2str(cond) '_' int2str(f) 'Hzspm8_FIXv9_Win' int2str(win) 'width750ms.img']; cfg = []; % cfg.coordinates = 'spm'; % changed for version 5 % cfg.spmversion = 'spm8'; % changed for version 5 cfg.downsample = 4; sourcetempInt = ft_sourceinterpolate(cfg, sourcetemp , mri); % projecting the plot onto a surface... cfg = []; %cfg.coordinates = 'spm'; % changed for version 5 %cfg.coordinates = 'ctf'; % changed for version 5 cfg.coordinates = 'spm'; % changed back to spm for version 9 cfg.downsample = 4; %cfg.spmversion = 'spm8'; % changed for version 6 (because this gets specified in volumewrite) cfg.template = 'Hmatrix/mask.nii.nii'; % basically equivalent to using spm8/templates/EPI.nii, except that mask.nii (produced from fmri data) has the desired voxel size % cfg.name = [filename]; % changed for version 6 %cfg.write= 'yes'; % changed for version 6 (when this was set to 'yes' there was no subsequent call to volumewrite) cfg.write= 'no'; % changed for version 6 sourcetempIntN = ft_volumenormalise(cfg, sourcetempInt); % this whole cfg and function call added for version 6 cfg=[]; % cfg.parameter = string, describing the functional data to be processed, e.g. 'pow', 'coh' or 'nai' % cfg.filename = filename without the extension % cfg.filetype = 'analyze', 'spm', 'vmp' or 'vmr' % cfg.vmpversion = 1 or 2 (default) version of the vmp-format to use % cfg.coordinates = 'spm, 'ctf' or empty for interactive (default = []) cfg.parameter='pow'; cfg.filename=filename; cfg.filetype = 'spm'; cfg.spmversion = 'SPM8'; % capitalized after first error message from vers 6 % cfg.dataformat='nifti'; % added after first error message from vers 6 % commented out after 2nd error message from vers 6 %cfg.vmpversion=2; % this is a filetype, like spm, so don't need to specify unless cfg.filetyp='vmp' cfg.coordinates='spm'; ft_volumewrite(cfg,sourcetempIntN); On Wed, Feb 23, 2011 at 7:50 AM, jan-mathijs schoffelen wrote: Dear Jen, I notice that indeed in the documentation section of ft_write_volume there is a FIXME behind nifti. Yet, nifti format seems to be supported by ft_write_volume (at least in a recent version of fieldtrip). Did you try it at all (and ran into problems) or were you held back by the FIXME statement? Could you just try it out using a recent fieldtrip function? Thanks and best wishes Jan-Mathijs On Feb 23, 2011, at 2:21 AM, Jen Whitman wrote: Hello, While writing beamformed images to spm2 format in a previous version of fieldtrip (now lost due to a computer crash), I was able to get nice-looking results; networks of brain regions consistent with existing literature. When I try to write images from the same dataset and the same analysis to spm8 format, my results (t-images computed across subjects) end up being single clusters spanning large sections of the brain (e.g. a 'blob' spanning all of one hemisphere but not the other). Unfortunately, some aspects of my planned data analyses cannot be performed on spm2 images, so I have to find a way of writing to successfully to nifti format. I just noticed that in the comments in the ft_write_volume function, which I am calling via ft_volumewrite, it says 'FIXME' next to nifti under the list of supported dataformats. Is there by any chance a patch out there for writing nifti images? Thanks! _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: headmodel_with_neuromag.m Type: application/octet-stream Size: 2780 bytes Desc: headmodel_with_neuromag.m URL: From jan.schoffelen at donders.ru.nl Wed Apr 13 16:57:07 2011 From: jan.schoffelen at donders.ru.nl (jan-mathijs schoffelen) Date: Wed, 13 Apr 2011 16:57:07 +0200 Subject: [FieldTrip] I think you solved the problem In-Reply-To: <72E993C35FB11743B79FF9286E5B6D8B026763B8@Mail2-UKD.VMED.UKD> References: <72E993C35FB11743B79FF9286E5B6D8B02676142@Mail2-UKD.VMED.UKD><7B5CA863-D143-404C-BCB9-805AA6E6E546@donders.ru.nl><72E993C35FB11743B79FF9286E5B6D8B02676264@Mail2-UKD.VMED.UKD> <72E993C35FB11743B79FF9286E5B6D8B026763B8@Mail2-UKD.VMED.UKD> Message-ID: <5AC469DB-D5B1-4E3C-AE21-01A53AE94A26@donders.ru.nl> Dear Jan, No problem. Thanks for the script. If you feel up to it, you are kindly invited to update the documentation on the fieldtrip wiki as well. If I recall correctly, at some point Hanneke added some documentation about how to create MNI-based dipole grids for neuromag data. A lot of the intermediate steps have now become obsolete and this part of the wiki can be substantially cleaned. Thanks, Jan-Mathijs On Apr 13, 2011, at 2:31 PM, wrote: > Dear Jan-Mathijs, > > I think we solved the problem. Everthing is like you said in the > first place. ft_volumerealign and ft_volumesegment should be called > with cfg.coordsys=’neuromag’. The only thing that was wrong is that > for the voxel coordinates read from the Neuromag GUI x and y should > be swapped. For anyone interested I attach a script that is meant to > be easy-to-use for beginners. > > Thank you very much for your time! > Von: fieldtrip-bounces at donders.ru.nl [mailto:fieldtrip-bounces at donders.ru.nl > ] Im Auftrag von jan-mathijs schoffelen > Gesendet: Dienstag, 12. April 2011 21:18 > An: Email discussion list for the FieldTrip project > Betreff: Re: [FieldTrip] I think you solved the problem > > Dear Jan, > > I suspect that your mri, as it comes out of ft_read_mri is already > coregistered in neuromag space. After your realignment and after > replacing mri.transform with real_mri.transform, the coordinate axes > in your pic1 look strange. This I think causes the 'dropped pocket > change'. > What happens if you skip the ft_volumerealign step and call > ft_volumesegment directly on the mri (with cfg.coordsys = > 'neuromag', or, for what it's worth, without cfg.coordsys; in this > case you will be able to verify the coordinate system)? > Alternatively, if this doesn't work, could you replace mri.transform > by eye(4) prior to calling ft_volumerealign and ft_volumesegment > (both with cfg.coordsys = 'neuromag' and no further tampering with > transformation matrices?). > > Thanks > > JM > > > On Apr 12, 2011, at 8:49 PM, > wrote: > > > Dear Jan-Mathijs, > > sorry, I think I was a bit too enthusiastic when I said everything > worked out wonderfully. It worked only once. After an afternoon of > confusion I concluded that on my first try I must have misspelled > cfg.coordsys=’neuromag’ on my calls to ft_volumerealign and > ft_volumesegment. In fact, the segmentation looks really bad with > these settings. What works for me is written underneath: > > mri = ft_read_mri('….fif'); > hdr=ft_read_header('…fif'); > mri.anatomy=double(mri.anatomy); > > %this is taken from the Neuromag GUI for MRI-MEG Integration > cfg=[]; > cfg.fiducial.rpa=[136.35 142.80 31.96]; > cfg.fiducial.nas=[47.84 101.80 100.10]; > cfg.fiducial.lpa=[139.22 146.17 162.69]; > > %go from neuromag voxel to neuromag head coordinates > cfg.coordsys='neuromag'; > cfg.method='fiducial'; > real_mri=ft_volumerealign(cfg,mri); > > %taking real_mri with its coordsys field will not work, so I take mri > mri.transform=real_mri.transform; > > cfg = []; > cfg.keepintermediate = 'no'; > cfg.write = 'no'; > segmentedmri = ft_volumesegment(cfg, mri); > > > Before segmentation the function shows some kind of brain (pic 1). > When segmentation is done the segmented brain looks good (pic 2) but > the brain does not fit the helmet (pic 3). It is looking at its feet > as if it dropped some pocket change. Do you know what is going on? > > Thanks, > jan > > Von: fieldtrip-bounces at donders.ru.nl [mailto:fieldtrip-bounces at donders.ru.nl > ] Im Auftrag von jan-mathijs schoffelen > Gesendet: Dienstag, 12. April 2011 12:11 > An: Email discussion list for the FieldTrip project > Betreff: Re: [FieldTrip] I think you solved the problem > > Dear Jan, > > Apart from not being properly aligned, the segmentation looks a bit > strange to me. I suspect that not everything went well here ;o). > Could you try the following: > > specify cfg.coordsys = 'neuromag', both in your call to > ft_volumerealign and in your call to ft_volumesegment. The > cfg.coordinates for ft_volumesegment has to be removed (actually it > is a deprecated option). The idea now is that mri-structures in > fieldtrip can have a coordsys field, which allows for more > transparent use of the different head coordinate system conventions. > This takes away the need for intermediately coregistering the MRI in > 'ctf'-convention, and would also take away your need to call > headcoordinates later on. > > Best wishes, > > Jan-Mathijs > > > On Apr 12, 2011, at 11:07 AM, duesseldorf.de> wrote: > > > > Dear fieldtrip experts, > > I have two questions regarding head model creation. As noted on this > thread, the volumesegment function was updated and I tested it for > our Neuromag data. The segmentation is performed, but unfortunately > it is not aligned with the MRI in my case. Here is the code I am > using, the fieldtrip is from 9th April 2011. > > %read mri > mri = ft_read_mri(subject_files.fiff_mri); > mri.anatomy=double(mri.anatomy); > > %these are the fiducials for this subject taken from the Neuromag > GUI for coregistration > cfg=[]; > cfg.fiducial.rpa=[136.35 142.80 31.96]; > cfg.fiducial.nas=[47.84 101.80 100.10]; > cfg.fiducial.lpa=[139.22 146.17 162.69]; > > %define the head coordinate system according to CTF conventions > cfg.method='fiducial'; > real_mri=ft_volumerealign(cfg,mri); > > %segment > cfg = []; > cfg.template = '/data/apps/spm/spm8/templates/T1.nii'; > cfg.coordinates = 'ctf'; > cfg.keepintermediate = 'no'; > segmentedmri = ft_volumesegment(cfg, real_mri); > > %plot white matter > test=segmentedmri; > test.anatomy=real_mri.anatomy; > cfg=[]; > cfg.funparameter='white'; > ft_sourceplot(cfg,test); %see attached picture > > The other issue regards back-transformation from CTF to Neuromag > coordinates, which is necessary to make the head model fit the > sensors. My idea was to create an appropriate transformation matrix > like this. > > cd /net/avidya/storage/home/jan/fieldtrip-20110409/private > ctfmat=headcoordinates(nas,lpa,rpa,'ctf'); > nmmat=headcoordinates(nas,lpa,rpa,'neuromag'); > ctf_to_nm=nmmat/ctfmat; > > > And then to use it on the head model to bring it back into Neuromag > coordinates: > > %create single shell, realistic headmodel > cfg = []; > hdm = ft_prepare_singleshell(cfg,segmentedmri); > > % transformation of headmodel into Neuromag space > hdm.bnd.pnt=warp_apply(ctf_to_nm,hdm.bnd.pnt,'homogeneous'); > > Does this survive a sanity check? > > Best regards and thanks a lot, > > Jan > > > Von: fieldtrip-bounces at donders.ru.nl [mailto:fieldtrip-bounces at donders.ru.nl > ] Im Auftrag von Jen Whitman > Gesendet: Montag, 28. Februar 2011 22:32 > An: Email discussion list for the FieldTrip project > Betreff: [FieldTrip] I think you solved the problem > > I just checked, and when I re-ran my segmentation script with the > new Fieldtrip in order to use an spm8 template image, coordinates > got reversed. When I take out the calls to flipdim, they look fine > (see attached screenshots). That certainly explains the meaningless > results I was getting! > > Thanks for figuring that out, > > Jen > > On Mon, Feb 28, 2011 at 12:36 PM, jan-mathijs schoffelen > wrote: > Hi Jen, > > At first glance I have a comment on your script. You may need to > explicitly check the alignment of your segmented volume and the > original anatomy. A while a go some changes were made to > ft_volumesegment, taking away the need to do the flipdim(flipdim... > operations. I have posted this on the discussion list last January, > but you may not have noticed. > Anyway, if you now have used a recent version of FieldTrip for your > segmentation both the location of your dipole grid, and the volume > conductor model will not be adequately coregistered with the data, > which may lead to funky results to begin with. That's most likely > not related to the filetype in which the volumes are saved for later > use. > > Best wishes, > > Jan-Mathijs > > > > On Feb 28, 2011, at 8:59 PM, Jen Whitman wrote: > > > > > Hello Jan, > > When calling volumesegment, I specified 'ctf' as the coordinate > system. The function I wrote to call volumesegment and > prepare_singleshell for each subject and save the results is pasted > below, with a couple of comments added for clarity. > Over the weekend I tried specifying the coordinate system in the > call to ft_volumenormalise as 'ctf' rather than 'spm', and commented > out all the lines that said cfg.spmversion = 'spm8'; before calling > a function. However, that created worse results, as each plot > involved stripes of activation and empty voxels, suggesting that > 'ctf' was not the correct coordinate system to specify. > > Thanks for the attached script. Looking in that the comments in > that, I suspect that the solution to my problems will be to specify > my filetype as nifti_img rather than nifti. I'll let you know how > that goes. > > Jen > > ------------------------------------------------------------------------------------------------------------ > % the variable subj is simply a string consisting of a subject > number (e.g. 's05') which can be a folder name or part of a filename > function [vol mri segmentedmri > segmentedmriF]=call_volume_segment_function_spm8(subj) > cfg.spmversion = 'spm8'; > cfg.template = '/home/woodwardlab/spm8/templates/EPI.nii'; > %cfg.template='/home/common/matlab/spm2/templates/T1.mnc'; > cfg.name=[subj '_volseg']; > cfg.write='yes'; > cfg.smooth='no'; > cfg.coordinates='ctf'; > mri=read_mri([subj '/mri/' subj 'head.mri']); % made with CTF > mriConverter and mriViewer software, after fiducials were marked > segmentedmri = volumesegment(cfg, mri); > segmentedmriF = segmentedmri; > segmentedmriF.gray = flipdim(flipdim(flipdim(segmentedmriF.gray,3), > 2),1); > segmentedmriF.white = flipdim(flipdim(flipdim(segmentedmriF.white,3), > 2),1); > segmentedmriF.csf = flipdim(flipdim(flipdim(segmentedmriF.csf,3), > 2),1); > segmentedmriF.transform = mri.transform; > segmentedmriF.anatomy = mri.anatomy; > cfg = []; > cfg.spmversion = 'spm8'; > vol = prepare_singleshell(cfg, segmentedmriF); > eval(['save ' subj '/meg/mrisegmented.mat mri segmentedmri > segmentedmriF vol']) > > > > > > On Sat, Feb 26, 2011 at 5:26 AM, jan-mathijs schoffelen > wrote: > Dear Jen, > > I do not manage to reproduce your issue, when only focussing on the > ft_volumewrite and visualization part of your pipeline. See attached > script, and yet an updated version of ft_volumewrite which you need > to (hopefully) draw the same conclusion as I did. > Yet, I only now realize that your question may pertain to the entire > pipeline. It could be that something is going wrong there. > I only see now that in the part of your script of which you reported > that it gave 'good' results, you specify cfg.coordinates = 'ctf' > before calling ft_volumenormalise. I assume this is correct, because > the coordinate system your source-reconstructed data lives in, is > according to the CTF-convention, and not according to the SPM- > convention. On the other hand, the template for the spatial > normalization lives in the SPM-coordinate system. In order for the > spatial normalization to work OK, Fieldtrip tries to convert from > one coordinate system to the other (once again, this is appropriate > behaviour), before doing the actual normalization. It seems that at > least in the script you sent along, in the final (not working > version), you specified cfg.coordinates = 'spm' prior to calling > ft_volumenormalise. This is probably wrong. > Another important point that should be mentioned, is that the > coordinate systems in which the functional data and the anatomical > data live should be the same for the ft_sourceinterpolate to make > sense. In other words, if your source reconstructed images are > defined on a 3D grid of positions in CTF-space, the mri.transform of > your anatomy should describe a transformation from voxel to CTF-space. > I think you may want to revisit step by step this part of the > pipeline; I don't think the problem lies in the writing. > A final possibility of course is that Mricron is misbehaving... > > Best, > > Jan-Mathijs > > > > > > > On Feb 25, 2011, at 9:44 PM, Jen Whitman wrote: > > > > > Hi Jan, > > I tried re-running the analysis with the new script you sent me, and > the latest version of fieldtrip (since I needed ft_get_opt as well), > but the spm8 images being written are still producing flawed > results. It's the same problem as I mentioned briefly in my previous > post. I am not getting any error messages when writing these images. > Rather, my problem is that the spm8 and spm2 results from the same > data ought to be identical when viewed in mricron, but they're far > from it. When I use mricron to look at the results from the spm8- > format images, combined across participants to create a t-image, I > just get a single 'blob' spanning roughly half the brain. In > contrast, when I used spm2-format previously on the same data, the t- > image was much more meaningful; a posterior alpha power decrease in > a set of regions corresponding to the 'task-positive network' (a > network found in the results of an fMRI version of my experiment, > and widely reported in the fMRI literature). > > This failure to replicate the spm2 results when using spm8 images > from the same data leads me to suspect that something is wrong with > the coordinates for spm8 format. However, after experimenting > extensively with different cfg options I still haven't identified > the problem. If I my structural MRIs have been saved to .mri files > using CTF's MRIConverter program, which cfg options, particularly > for coordinates, template images, and filetypes, should I specify > before calling the ft_volumesegment, ft_prepare_singleshell, > ft_sourceinterpolate, ft_volumenormalise, and ft_volumewrite > functions? Or should I be calling a different set of functions now? > > Thanks again for your help, > > Jen > > On Thu, Feb 24, 2011 at 10:07 AM, Jen Whitman > wrote: > Great, thanks! > > I'll start the analysis with your new script today and will let you > know how it works out. > > Jen > > On Thu, Feb 24, 2011 at 4:44 AM, jan-mathijs schoffelen > wrote: > Dear Jen, > > I managed to reproduce your problem. The code was rather buggy and > indeed ft_volumewrite did not behave as it should have. I now fixed > it in the code and it should run fine now. Please find the updated > file attached. It will be available on our ftp-server as of tonight. > Please note that I updated the documentation, and changed the names > of some of the options a bit. If you want to save your data in > analyze-format, you should specify cfg.filetype = 'analyze_spm'. If > you specify cfg.filetype = 'nifti', it should write out a volume to > nifti-format, using SPM8. > > Best wishes, > > Jan-Mathijs > > > > > > On Feb 23, 2011, at 7:44 PM, Jen Whitman wrote: > >> >> Dear Jan, >> >> Thanks for the quick reply. Yes, I have tried it out quite a few >> times now, experimenting with different settings in the cfgs. Below >> I'll paste the code I've been using to write images - first the >> code that successfully created spm2 images that produced good >> results, then the code used for creating nifti format images from >> the same data. The comments in this second part are at this point a >> bit of a maze of cfg options I've been changing back & forth. Any >> insights/suggestions regarding how to set up my cfgs to make this >> work would be greatly appreciated. >> >> Jen >> >> >> %%%%%%%% this code generated spm2-compatible images which did work >> (producing results that made sense). >> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% >> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% >> >> sourcetemp.avg.pow = (sourcetemp.avg.pow - >> sourcePre.avg.pow) ./ sourcePre.avg.pow; >> >> cfg = []; >> cfg.downsample = 2; >> sourcetempInt = sourceinterpolate(cfg, sourcetemp , mri); >> >> % projecting the plot onto a surface... >> cfg = []; >> cfg.coordinates = 'ctf'; >> cfg.template = '/home/common/matlab/spm2/templates/T1.mnc'; >> %this template is in MNI coordinates >> sourcetempIntN = volumenormalise(cfg, sourcetempInt); >> >> filename=[subj 'run' int2str(r) 'cond' int2str(cond) '_' >> int2str(f) 'HzWin' int2str(win) 'width750ms']; >> cfg=[]; >> cfg.parameter = 'avg.pow'; % string, describing the >> functional data to be processed, e.g. 'pow', 'coh' or 'nai' >> cfg.filename = [filename '.img']; >> %'testimageoutput_alphafreq'; % filename without the extension >> cfg.filetype = 'spm'; %'analyze', 'spm', 'vmp' or 'vmr' >> cfg.coordinates = 'spm'; %'spm, 'ctf' or empty for >> interactive (default = []) >> cfg.datatype = 'double'; %'float'; %'double'; %'bit1', 'uint8', >> 'int16', 'int32', 'float' or 'double' >> >> volumewrite(cfg, sourcetempIntN) >> >> >> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% >> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% >> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% >> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% >> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% >> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% >> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% >> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% >> %%%%% this code below hasn't worked yet... >> >> % I added cfg.spmversion = 'spm8'; >> % in the cfgs for the calls to ft_prepare_leadfield and >> ft_sourceanalysis, >> % and in the call to prepare_singleshell after calling volumesegment >> >> % I've also ensured that spm8 is the only spm version in my path, >> even in >> % the fieldtrip/external folder, and ensured that spm8 is installed >> properly >> % (files compiled correctly, etc..) >> >> sourcetemp.avg.pow = (sourcetemp.avg.pow - >> sourcePre.avg.pow) ./ sourcePre.avg.pow; >> >> filename=[subj 'run' int2str(r) 'cond' int2str(cond) '_' >> int2str(f) 'Hzspm8_FIXv9_Win' int2str(win) 'width750ms.img']; >> >> cfg = []; >> % cfg.coordinates = 'spm'; % changed for version 5 >> % cfg.spmversion = 'spm8'; % changed for version 5 >> cfg.downsample = 4; >> sourcetempInt = ft_sourceinterpolate(cfg, sourcetemp , mri); >> >> >> % projecting the plot onto a surface... >> cfg = []; >> %cfg.coordinates = 'spm'; % changed for version 5 >> %cfg.coordinates = 'ctf'; % changed for version 5 >> cfg.coordinates = 'spm'; % changed back to spm for version 9 >> cfg.downsample = 4; >> %cfg.spmversion = 'spm8'; % changed for version 6 (because this >> gets specified in volumewrite) >> cfg.template = 'Hmatrix/mask.nii.nii'; % basically equivalent >> to using spm8/templates/EPI.nii, except that mask.nii (produced >> from fmri data) has the desired voxel size >> % cfg.name = [filename]; % changed for version 6 >> %cfg.write= 'yes'; % changed for version 6 (when this was set >> to 'yes' there was no subsequent call to volumewrite) >> cfg.write= 'no'; % changed for version 6 >> sourcetempIntN = ft_volumenormalise(cfg, sourcetempInt); >> >> % this whole cfg and function call added for version 6 >> cfg=[]; >> % cfg.parameter = string, describing the functional data >> to be processed, e.g. 'pow', 'coh' or 'nai' >> % cfg.filename = filename without the extension >> % cfg.filetype = 'analyze', 'spm', 'vmp' or 'vmr' >> % cfg.vmpversion = 1 or 2 (default) version of the vmp-format >> to use >> % cfg.coordinates = 'spm, 'ctf' or empty for interactive >> (default = []) >> cfg.parameter='pow'; >> cfg.filename=filename; >> cfg.filetype = 'spm'; >> cfg.spmversion = 'SPM8'; % capitalized after first error >> message from vers 6 >> % cfg.dataformat='nifti'; % added after first error message from >> vers 6 >> % commented out after 2nd error >> message from vers 6 >> %cfg.vmpversion=2; % this is a filetype, like spm, so don't >> need to specify unless cfg.filetyp='vmp' >> cfg.coordinates='spm'; >> ft_volumewrite(cfg,sourcetempIntN); >> >> >> >> >> >> >> >> On Wed, Feb 23, 2011 at 7:50 AM, jan-mathijs schoffelen > > wrote: >> Dear Jen, >> >> I notice that indeed in the documentation section of >> ft_write_volume there is a FIXME behind nifti. Yet, nifti format >> seems to be supported by ft_write_volume (at least in a recent >> version of fieldtrip). Did you try it at all (and ran into >> problems) or were you held back by the FIXME statement? Could you >> just try it out using a recent fieldtrip function? >> >> Thanks and best wishes >> >> Jan-Mathijs >> >> >> >> On Feb 23, 2011, at 2:21 AM, Jen Whitman wrote: >> >> Hello, >> >> While writing beamformed images to spm2 format in a previous >> version of fieldtrip (now lost due to a computer crash), I was able >> to get nice-looking results; networks of brain regions consistent >> with existing literature. When I try to write images from the same >> dataset and the same analysis to spm8 format, my results (t-images >> computed across subjects) end up being single clusters spanning >> large sections of the brain (e.g. a 'blob' spanning all of one >> hemisphere but not the other). Unfortunately, some aspects of my >> planned data analyses cannot be performed on spm2 images, so I have >> to find a way of writing to successfully to nifti format. >> >> I just noticed that in the comments in the ft_write_volume >> function, which I am calling via ft_volumewrite, it says 'FIXME' >> next to nifti under the list of supported dataformats. Is there by >> any chance a patch out there for writing nifti images? >> >> Thanks! >> >> _______________________________________________ >> fieldtrip mailing list >> fieldtrip at donders.ru.nl >> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip >> >> Dr. J.M. (Jan-Mathijs) Schoffelen >> Donders Institute for Brain, Cognition and Behaviour, >> Centre for Cognitive Neuroimaging, >> Radboud University Nijmegen, The Netherlands >> J.Schoffelen at donders.ru.nl >> Telephone: 0031-24-3614793 >> >> _______________________________________________ >> fieldtrip mailing list >> fieldtrip at donders.ru.nl >> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip >> >> _______________________________________________ >> fieldtrip mailing list >> fieldtrip at donders.ru.nl >> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > > > Dr. J.M. (Jan-Mathijs) Schoffelen > Donders Institute for Brain, Cognition and Behaviour, > Centre for Cognitive Neuroimaging, > Radboud University Nijmegen, The Netherlands > J.Schoffelen at donders.ru.nl > Telephone: 0031-24-3614793 > > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > > Dr. J.M. (Jan-Mathijs) Schoffelen > Donders Institute for Brain, Cognition and Behaviour, > Centre for Cognitive Neuroimaging, > Radboud University Nijmegen, The Netherlands > J.Schoffelen at donders.ru.nl > Telephone: 0031-24-3614793 > > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > > Dr. J.M. (Jan-Mathijs) Schoffelen > Donders Institute for Brain, Cognition and Behaviour, > Centre for Cognitive Neuroimaging, > Radboud University Nijmegen, The Netherlands > J.Schoffelen at donders.ru.nl > Telephone: 0031-24-3614793 > > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > > Dr. J.M. (Jan-Mathijs) Schoffelen > Donders Institute for Brain, Cognition and Behaviour, > Centre for Cognitive Neuroimaging, > Radboud University Nijmegen, The Netherlands > J.Schoffelen at donders.ru.nl > Telephone: 0031-24-3614793 > > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > > Dr. J.M. (Jan-Mathijs) Schoffelen > Donders Institute for Brain, Cognition and Behaviour, > Centre for Cognitive Neuroimaging, > Radboud University Nijmegen, The Netherlands > J.Schoffelen at donders.ru.nl > Telephone: 0031-24-3614793 > > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 -------------- next part -------------- An HTML attachment was scrubbed... URL: From inieuwenhuis at berkeley.edu Wed Apr 13 20:51:46 2011 From: inieuwenhuis at berkeley.edu (Ingrid Nieuwenhuis) Date: Wed, 13 Apr 2011 11:51:46 -0700 Subject: [FieldTrip] invalid MEX file error in clusterstat Message-ID: <4DA5F0C2.7090405@berkeley.edu> Hi I'm running ft_sourcestatistics with the following cfg: %%% cluster statistics cfg = []; cfg.parameter = 'stat'; cfg.method = 'montecarlo'; cfg.statistic = 'depsamplesT'; cfg.clusteralpha = 0.05; cfg.numrandomization = 1000; cfg.correctm = 'cluster'; cfg.design(1,1:2*Nsub) = [ones(1,Nsub) 2*ones(1,Nsub)]; cfg.design(2,1:2*Nsub) = [1:Nsub 1:Nsub]; cfg.ivar = 1; cfg.uvar = 2; cfg.alpha = 0.025; %one sided alpha!! stat_clus = ft_sourcestatistics(cfg, Rem{1:Nsub}, Rec{1:Nsub}); and get the below error, am I doing anything wrong (I must admit, I'm running a 2 year old script (which has already generated new data out of 2 year old source data without any errors: very impressive backward compatibility!), or is there just a MEX file missing? Thanks, Ingrid ??? Invalid MEX-file '/home/common/matlab/fieldtrip/external/spm8/spm_bwlabel.mexa64': /home/common/matlab/fieldtrip/external/spm8/spm_bwlabel.mexa64: undefined symbol: mxCreateNumericArray_700. Error in ==> fieldtrip/private/clusterstat at 189 [posclusobs, posnum] = spm_bwlabel(tmp, 6); % use spm_bwlabel for source data to avoid usage of image toolbox Error in ==> statistics_montecarlo at 322 [stat, cfg] = clusterstat(cfg, statrand, statobs,'issource',issource); Error in ==> fieldtrip/private/statistics_wrapper at 285 [stat, cfg] = statmethod(cfg, dat, cfg.design, 'issource',issource); Error in ==> ft_sourcestatistics at 114 [stat, cfg] = statistics_wrapper(cfg, varargin{:}); -- Ingrid Nieuwenhuis PhD Sleep and Neuroimaging Laboratory Department of Psychology University of California, Berkeley California 94720-1650 From mcoskun at mail.uh.edu Thu Apr 14 08:51:46 2011 From: mcoskun at mail.uh.edu (Mehmet-Akif Coskun) Date: Thu, 14 Apr 2011 01:51:46 -0500 Subject: [FieldTrip] dipole time course vs. virtual sensor using SVD Message-ID: <715094a06745c.4da65332@mail.uh.edu> Dear Fieldtrippers, I have been running a simple analysis for two different subject groups on the dipole time course and a virtual sensor using Singular Value Decomposition. The analysis for the two signals yielded different results. I would like to get comments on this issue. The computation of the two signals are as below: dataset: I have 248 channels x 122 time points data (averaged over a number of trials).  1) Virtual sensor using SVD: I isolated the data from 30-100ms (isolated_data: 248 x 22 timepoints) and apply SVD as [U,S,V]=svd(isolated_data). The first column of U (248x1) accounts for the largest proportion of variance and is a vector of weights assigned to the signal recorded from each of the 248 sensors. So i computed the virtual sensors as virt_sens=U(:,1)'*dataset which is a 1x122 signal. 2)Dipole time course: I fitted 1 dipole (ft_dipolefitting) to the data between 30 and 100ms, computed leadfields (ft_compute_leadfield) for the dipole and projected the pinv'ed leadfields on to the dataset to obtain the dipole time course. What may cause the differences in the results for the two approaches? What kind of mathematical assumptions does SVD and dipole fitting does? what are the weakness or the strengths of the two approaches and which one has to be trusted more? I will really appreciate any comments and suggestions. Best regards, Mehmet Coskun -------------- next part -------------- An HTML attachment was scrubbed... URL: From Jan.Hirschmann at med.uni-duesseldorf.de Thu Apr 14 09:31:51 2011 From: Jan.Hirschmann at med.uni-duesseldorf.de (Jan.Hirschmann at med.uni-duesseldorf.de) Date: Thu, 14 Apr 2011 09:31:51 +0200 Subject: [FieldTrip] I think you solved the problem In-Reply-To: <5AC469DB-D5B1-4E3C-AE21-01A53AE94A26@donders.ru.nl> References: <72E993C35FB11743B79FF9286E5B6D8B02676142@Mail2-UKD.VMED.UKD><7B5CA863-D143-404C-BCB9-805AA6E6E546@donders.ru.nl><72E993C35FB11743B79FF9286E5B6D8B02676264@Mail2-UKD.VMED.UKD><72E993C35FB11743B79FF9286E5B6D8B026763B8@Mail2-UKD.VMED.UKD> <5AC469DB-D5B1-4E3C-AE21-01A53AE94A26@donders.ru.nl> Message-ID: <72E993C35FB11743B79FF9286E5B6D8B02676493@Mail2-UKD.VMED.UKD> Dear Jan-Mathijs, sure, I will do that. I have tested one head model with ft_dipole_simulation and beamforming and it looks good (at least when I simulate two conditions and subtract sources the right location comes out). So I guess we (and maybe others) will use the new procedure now. Best, jan ________________________________ Von: fieldtrip-bounces at donders.ru.nl [mailto:fieldtrip-bounces at donders.ru.nl] Im Auftrag von jan-mathijs schoffelen Gesendet: Mittwoch, 13. April 2011 16:57 An: Email discussion list for the FieldTrip project Betreff: Re: [FieldTrip] I think you solved the problem Dear Jan, No problem. Thanks for the script. If you feel up to it, you are kindly invited to update the documentation on the fieldtrip wiki as well. If I recall correctly, at some point Hanneke added some documentation about how to create MNI-based dipole grids for neuromag data. A lot of the intermediate steps have now become obsolete and this part of the wiki can be substantially cleaned. Thanks, Jan-Mathijs On Apr 13, 2011, at 2:31 PM, wrote: Dear Jan-Mathijs, I think we solved the problem. Everthing is like you said in the first place. ft_volumerealign and ft_volumesegment should be called with cfg.coordsys='neuromag'. The only thing that was wrong is that for the voxel coordinates read from the Neuromag GUI x and y should be swapped. For anyone interested I attach a script that is meant to be easy-to-use for beginners. Thank you very much for your time! ________________________________ Von: fieldtrip-bounces at donders.ru.nl [mailto:fieldtrip-bounces at donders.ru.nl] Im Auftrag von jan-mathijs schoffelen Gesendet: Dienstag, 12. April 2011 21:18 An: Email discussion list for the FieldTrip project Betreff: Re: [FieldTrip] I think you solved the problem Dear Jan, I suspect that your mri, as it comes out of ft_read_mri is already coregistered in neuromag space. After your realignment and after replacing mri.transform with real_mri.transform, the coordinate axes in your pic1 look strange. This I think causes the 'dropped pocket change'. What happens if you skip the ft_volumerealign step and call ft_volumesegment directly on the mri (with cfg.coordsys = 'neuromag', or, for what it's worth, without cfg.coordsys; in this case you will be able to verify the coordinate system)? Alternatively, if this doesn't work, could you replace mri.transform by eye(4) prior to calling ft_volumerealign and ft_volumesegment (both with cfg.coordsys = 'neuromag' and no further tampering with transformation matrices?). Thanks JM On Apr 12, 2011, at 8:49 PM, wrote: Dear Jan-Mathijs, sorry, I think I was a bit too enthusiastic when I said everything worked out wonderfully. It worked only once. After an afternoon of confusion I concluded that on my first try I must have misspelled cfg.coordsys='neuromag' on my calls to ft_volumerealign and ft_volumesegment. In fact, the segmentation looks really bad with these settings. What works for me is written underneath: mri = ft_read_mri('....fif'); hdr=ft_read_header('...fif'); mri.anatomy=double(mri.anatomy); %this is taken from the Neuromag GUI for MRI-MEG Integration cfg=[]; cfg.fiducial.rpa=[136.35 142.80 31.96]; cfg.fiducial.nas=[47.84 101.80 100.10]; cfg.fiducial.lpa=[139.22 146.17 162.69]; %go from neuromag voxel to neuromag head coordinates cfg.coordsys='neuromag'; cfg.method='fiducial'; real_mri=ft_volumerealign(cfg,mri); %taking real_mri with its coordsys field will not work, so I take mri mri.transform=real_mri.transform; cfg = []; cfg.keepintermediate = 'no'; cfg.write = 'no'; segmentedmri = ft_volumesegment(cfg, mri); Before segmentation the function shows some kind of brain (pic 1). When segmentation is done the segmented brain looks good (pic 2) but the brain does not fit the helmet (pic 3). It is looking at its feet as if it dropped some pocket change. Do you know what is going on? Thanks, jan ________________________________ Von: fieldtrip-bounces at donders.ru.nl [mailto:fieldtrip-bounces at donders.ru.nl] Im Auftrag von jan-mathijs schoffelen Gesendet: Dienstag, 12. April 2011 12:11 An: Email discussion list for the FieldTrip project Betreff: Re: [FieldTrip] I think you solved the problem Dear Jan, Apart from not being properly aligned, the segmentation looks a bit strange to me. I suspect that not everything went well here ;o). Could you try the following: specify cfg.coordsys = 'neuromag', both in your call to ft_volumerealign and in your call to ft_volumesegment. The cfg.coordinates for ft_volumesegment has to be removed (actually it is a deprecated option). The idea now is that mri-structures in fieldtrip can have a coordsys field, which allows for more transparent use of the different head coordinate system conventions. This takes away the need for intermediately coregistering the MRI in 'ctf'-convention, and would also take away your need to call headcoordinates later on. Best wishes, Jan-Mathijs On Apr 12, 2011, at 11:07 AM, wrote: Dear fieldtrip experts, I have two questions regarding head model creation. As noted on this thread, the volumesegment function was updated and I tested it for our Neuromag data. The segmentation is performed, but unfortunately it is not aligned with the MRI in my case. Here is the code I am using, the fieldtrip is from 9th April 2011. %read mri mri = ft_read_mri(subject_files.fiff_mri); mri.anatomy=double(mri.anatomy); %these are the fiducials for this subject taken from the Neuromag GUI for coregistration cfg=[]; cfg.fiducial.rpa=[136.35 142.80 31.96]; cfg.fiducial.nas=[47.84 101.80 100.10]; cfg.fiducial.lpa=[139.22 146.17 162.69]; %define the head coordinate system according to CTF conventions cfg.method='fiducial'; real_mri=ft_volumerealign(cfg,mri); %segment cfg = []; cfg.template = '/data/apps/spm/spm8/templates/T1.nii'; cfg.coordinates = 'ctf'; cfg.keepintermediate = 'no'; segmentedmri = ft_volumesegment(cfg, real_mri); %plot white matter test=segmentedmri; test.anatomy=real_mri.anatomy; cfg=[]; cfg.funparameter='white'; ft_sourceplot(cfg,test); %see attached picture The other issue regards back-transformation from CTF to Neuromag coordinates, which is necessary to make the head model fit the sensors. My idea was to create an appropriate transformation matrix like this. cd /net/avidya/storage/home/jan/fieldtrip-20110409/private ctfmat=headcoordinates(nas,lpa,rpa,'ctf'); nmmat=headcoordinates(nas,lpa,rpa,'neuromag'); ctf_to_nm=nmmat/ctfmat; And then to use it on the head model to bring it back into Neuromag coordinates: %create single shell, realistic headmodel cfg = []; hdm = ft_prepare_singleshell(cfg,segmentedmri); % transformation of headmodel into Neuromag space hdm.bnd.pnt=warp_apply(ctf_to_nm,hdm.bnd.pnt,'homogeneous'); Does this survive a sanity check? Best regards and thanks a lot, Jan ________________________________ Von: fieldtrip-bounces at donders.ru.nl [mailto:fieldtrip-bounces at donders.ru.nl] Im Auftrag von Jen Whitman Gesendet: Montag, 28. Februar 2011 22:32 An: Email discussion list for the FieldTrip project Betreff: [FieldTrip] I think you solved the problem I just checked, and when I re-ran my segmentation script with the new Fieldtrip in order to use an spm8 template image, coordinates got reversed. When I take out the calls to flipdim, they look fine (see attached screenshots). That certainly explains the meaningless results I was getting! Thanks for figuring that out, Jen On Mon, Feb 28, 2011 at 12:36 PM, jan-mathijs schoffelen wrote: Hi Jen, At first glance I have a comment on your script. You may need to explicitly check the alignment of your segmented volume and the original anatomy. A while a go some changes were made to ft_volumesegment, taking away the need to do the flipdim(flipdim... operations. I have posted this on the discussion list last January, but you may not have noticed. Anyway, if you now have used a recent version of FieldTrip for your segmentation both the location of your dipole grid, and the volume conductor model will not be adequately coregistered with the data, which may lead to funky results to begin with. That's most likely not related to the filetype in which the volumes are saved for later use. Best wishes, Jan-Mathijs On Feb 28, 2011, at 8:59 PM, Jen Whitman wrote: Hello Jan, When calling volumesegment, I specified 'ctf' as the coordinate system. The function I wrote to call volumesegment and prepare_singleshell for each subject and save the results is pasted below, with a couple of comments added for clarity. Over the weekend I tried specifying the coordinate system in the call to ft_volumenormalise as 'ctf' rather than 'spm', and commented out all the lines that said cfg.spmversion = 'spm8'; before calling a function. However, that created worse results, as each plot involved stripes of activation and empty voxels, suggesting that 'ctf' was not the correct coordinate system to specify. Thanks for the attached script. Looking in that the comments in that, I suspect that the solution to my problems will be to specify my filetype as nifti_img rather than nifti. I'll let you know how that goes. Jen ------------------------------------------------------------------------ ------------------------------------ % the variable subj is simply a string consisting of a subject number (e.g. 's05') which can be a folder name or part of a filename function [vol mri segmentedmri segmentedmriF]=call_volume_segment_function_spm8(subj) cfg.spmversion = 'spm8'; cfg.template = '/home/woodwardlab/spm8/templates/EPI.nii'; %cfg.template='/home/common/matlab/spm2/templates/T1.mnc'; cfg.name=[subj '_volseg']; cfg.write='yes'; cfg.smooth='no'; cfg.coordinates='ctf'; mri=read_mri([subj '/mri/' subj 'head.mri']); % made with CTF mriConverter and mriViewer software, after fiducials were marked segmentedmri = volumesegment(cfg, mri); segmentedmriF = segmentedmri; segmentedmriF.gray = flipdim(flipdim(flipdim(segmentedmriF.gray,3),2),1); segmentedmriF.white = flipdim(flipdim(flipdim(segmentedmriF.white,3),2),1); segmentedmriF.csf = flipdim(flipdim(flipdim(segmentedmriF.csf,3),2),1); segmentedmriF.transform = mri.transform; segmentedmriF.anatomy = mri.anatomy; cfg = []; cfg.spmversion = 'spm8'; vol = prepare_singleshell(cfg, segmentedmriF); eval(['save ' subj '/meg/mrisegmented.mat mri segmentedmri segmentedmriF vol']) On Sat, Feb 26, 2011 at 5:26 AM, jan-mathijs schoffelen wrote: Dear Jen, I do not manage to reproduce your issue, when only focussing on the ft_volumewrite and visualization part of your pipeline. See attached script, and yet an updated version of ft_volumewrite which you need to (hopefully) draw the same conclusion as I did. Yet, I only now realize that your question may pertain to the entire pipeline. It could be that something is going wrong there. I only see now that in the part of your script of which you reported that it gave 'good' results, you specify cfg.coordinates = 'ctf' before calling ft_volumenormalise. I assume this is correct, because the coordinate system your source-reconstructed data lives in, is according to the CTF-convention, and not according to the SPM-convention. On the other hand, the template for the spatial normalization lives in the SPM-coordinate system. In order for the spatial normalization to work OK, Fieldtrip tries to convert from one coordinate system to the other (once again, this is appropriate behaviour), before doing the actual normalization. It seems that at least in the script you sent along, in the final (not working version), you specified cfg.coordinates = 'spm' prior to calling ft_volumenormalise. This is probably wrong. Another important point that should be mentioned, is that the coordinate systems in which the functional data and the anatomical data live should be the same for the ft_sourceinterpolate to make sense. In other words, if your source reconstructed images are defined on a 3D grid of positions in CTF-space, the mri.transform of your anatomy should describe a transformation from voxel to CTF-space. I think you may want to revisit step by step this part of the pipeline; I don't think the problem lies in the writing. A final possibility of course is that Mricron is misbehaving... Best, Jan-Mathijs On Feb 25, 2011, at 9:44 PM, Jen Whitman wrote: Hi Jan, I tried re-running the analysis with the new script you sent me, and the latest version of fieldtrip (since I needed ft_get_opt as well), but the spm8 images being written are still producing flawed results. It's the same problem as I mentioned briefly in my previous post. I am not getting any error messages when writing these images. Rather, my problem is that the spm8 and spm2 results from the same data ought to be identical when viewed in mricron, but they're far from it. When I use mricron to look at the results from the spm8-format images, combined across participants to create a t-image, I just get a single 'blob' spanning roughly half the brain. In contrast, when I used spm2-format previously on the same data, the t-image was much more meaningful; a posterior alpha power decrease in a set of regions corresponding to the 'task-positive network' (a network found in the results of an fMRI version of my experiment, and widely reported in the fMRI literature). This failure to replicate the spm2 results when using spm8 images from the same data leads me to suspect that something is wrong with the coordinates for spm8 format. However, after experimenting extensively with different cfg options I still haven't identified the problem. If I my structural MRIs have been saved to .mri files using CTF's MRIConverter program, which cfg options, particularly for coordinates, template images, and filetypes, should I specify before calling the ft_volumesegment, ft_prepare_singleshell, ft_sourceinterpolate, ft_volumenormalise, and ft_volumewrite functions? Or should I be calling a different set of functions now? Thanks again for your help, Jen On Thu, Feb 24, 2011 at 10:07 AM, Jen Whitman wrote: Great, thanks! I'll start the analysis with your new script today and will let you know how it works out. Jen On Thu, Feb 24, 2011 at 4:44 AM, jan-mathijs schoffelen wrote: Dear Jen, I managed to reproduce your problem. The code was rather buggy and indeed ft_volumewrite did not behave as it should have. I now fixed it in the code and it should run fine now. Please find the updated file attached. It will be available on our ftp-server as of tonight. Please note that I updated the documentation, and changed the names of some of the options a bit. If you want to save your data in analyze-format, you should specify cfg.filetype = 'analyze_spm'. If you specify cfg.filetype = 'nifti', it should write out a volume to nifti-format, using SPM8. Best wishes, Jan-Mathijs On Feb 23, 2011, at 7:44 PM, Jen Whitman wrote: Dear Jan, Thanks for the quick reply. Yes, I have tried it out quite a few times now, experimenting with different settings in the cfgs. Below I'll paste the code I've been using to write images - first the code that successfully created spm2 images that produced good results, then the code used for creating nifti format images from the same data. The comments in this second part are at this point a bit of a maze of cfg options I've been changing back & forth. Any insights/suggestions regarding how to set up my cfgs to make this work would be greatly appreciated. Jen %%%%%%%% this code generated spm2-compatible images which did work (producing results that made sense). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% sourcetemp.avg.pow = (sourcetemp.avg.pow - sourcePre.avg.pow) ./ sourcePre.avg.pow; cfg = []; cfg.downsample = 2; sourcetempInt = sourceinterpolate(cfg, sourcetemp , mri); % projecting the plot onto a surface... cfg = []; cfg.coordinates = 'ctf'; cfg.template = '/home/common/matlab/spm2/templates/T1.mnc'; %this template is in MNI coordinates sourcetempIntN = volumenormalise(cfg, sourcetempInt); filename=[subj 'run' int2str(r) 'cond' int2str(cond) '_' int2str(f) 'HzWin' int2str(win) 'width750ms']; cfg=[]; cfg.parameter = 'avg.pow'; % string, describing the functional data to be processed, e.g. 'pow', 'coh' or 'nai' cfg.filename = [filename '.img']; %'testimageoutput_alphafreq'; % filename without the extension cfg.filetype = 'spm'; %'analyze', 'spm', 'vmp' or 'vmr' cfg.coordinates = 'spm'; %'spm, 'ctf' or empty for interactive (default = []) cfg.datatype = 'double'; %'float'; %'double'; %'bit1', 'uint8', 'int16', 'int32', 'float' or 'double' volumewrite(cfg, sourcetempIntN) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%% this code below hasn't worked yet... % I added cfg.spmversion = 'spm8'; % in the cfgs for the calls to ft_prepare_leadfield and ft_sourceanalysis, % and in the call to prepare_singleshell after calling volumesegment % I've also ensured that spm8 is the only spm version in my path, even in % the fieldtrip/external folder, and ensured that spm8 is installed properly % (files compiled correctly, etc..) sourcetemp.avg.pow = (sourcetemp.avg.pow - sourcePre.avg.pow) ./ sourcePre.avg.pow; filename=[subj 'run' int2str(r) 'cond' int2str(cond) '_' int2str(f) 'Hzspm8_FIXv9_Win' int2str(win) 'width750ms.img']; cfg = []; % cfg.coordinates = 'spm'; % changed for version 5 % cfg.spmversion = 'spm8'; % changed for version 5 cfg.downsample = 4; sourcetempInt = ft_sourceinterpolate(cfg, sourcetemp , mri); % projecting the plot onto a surface... cfg = []; %cfg.coordinates = 'spm'; % changed for version 5 %cfg.coordinates = 'ctf'; % changed for version 5 cfg.coordinates = 'spm'; % changed back to spm for version 9 cfg.downsample = 4; %cfg.spmversion = 'spm8'; % changed for version 6 (because this gets specified in volumewrite) cfg.template = 'Hmatrix/mask.nii.nii'; % basically equivalent to using spm8/templates/EPI.nii, except that mask.nii (produced from fmri data) has the desired voxel size % cfg.name = [filename]; % changed for version 6 %cfg.write= 'yes'; % changed for version 6 (when this was set to 'yes' there was no subsequent call to volumewrite) cfg.write= 'no'; % changed for version 6 sourcetempIntN = ft_volumenormalise(cfg, sourcetempInt); % this whole cfg and function call added for version 6 cfg=[]; % cfg.parameter = string, describing the functional data to be processed, e.g. 'pow', 'coh' or 'nai' % cfg.filename = filename without the extension % cfg.filetype = 'analyze', 'spm', 'vmp' or 'vmr' % cfg.vmpversion = 1 or 2 (default) version of the vmp-format to use % cfg.coordinates = 'spm, 'ctf' or empty for interactive (default = []) cfg.parameter='pow'; cfg.filename=filename; cfg.filetype = 'spm'; cfg.spmversion = 'SPM8'; % capitalized after first error message from vers 6 % cfg.dataformat='nifti'; % added after first error message from vers 6 % commented out after 2nd error message from vers 6 %cfg.vmpversion=2; % this is a filetype, like spm, so don't need to specify unless cfg.filetyp='vmp' cfg.coordinates='spm'; ft_volumewrite(cfg,sourcetempIntN); On Wed, Feb 23, 2011 at 7:50 AM, jan-mathijs schoffelen wrote: Dear Jen, I notice that indeed in the documentation section of ft_write_volume there is a FIXME behind nifti. Yet, nifti format seems to be supported by ft_write_volume (at least in a recent version of fieldtrip). Did you try it at all (and ran into problems) or were you held back by the FIXME statement? Could you just try it out using a recent fieldtrip function? Thanks and best wishes Jan-Mathijs On Feb 23, 2011, at 2:21 AM, Jen Whitman wrote: Hello, While writing beamformed images to spm2 format in a previous version of fieldtrip (now lost due to a computer crash), I was able to get nice-looking results; networks of brain regions consistent with existing literature. When I try to write images from the same dataset and the same analysis to spm8 format, my results (t-images computed across subjects) end up being single clusters spanning large sections of the brain (e.g. a 'blob' spanning all of one hemisphere but not the other). Unfortunately, some aspects of my planned data analyses cannot be performed on spm2 images, so I have to find a way of writing to successfully to nifti format. I just noticed that in the comments in the ft_write_volume function, which I am calling via ft_volumewrite, it says 'FIXME' next to nifti under the list of supported dataformats. Is there by any chance a patch out there for writing nifti images? Thanks! _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 -------------- next part -------------- An HTML attachment was scrubbed... URL: From r.oostenveld at donders.ru.nl Thu Apr 14 15:04:27 2011 From: r.oostenveld at donders.ru.nl (Robert Oostenveld) Date: Thu, 14 Apr 2011 15:04:27 +0200 Subject: [FieldTrip] Fwd: BCI in 2011 and 8th BCI2000 workshop: Early Registration Deadline April 20th References: Message-ID: Dear Colleague, Please note that the early registration-deadline for the two-day symposium 'Brain-Computer Interfacing in 2011' and the 8th BCI2000 workshop is approaching fast. After April 20th, participation is subject to increased registration fees. If you are interested in interfacing with the human brain, and would like to learn about the future directions of BCI research, register now on www.bci2011.eu. Yours Sincerely, The Organizing Committee Mariska van Steensel ‘Brain-Computer Interfacing in 2011’ What is this? A two-day symposium on Brain-Computer Interfacing When and Where? Utrecht, Netherlands, May 20&21, 2011 By Whom? UMC Utrecht/Rudolf Magnus Institute and the BrainGain Consortium For Whom? Anyone interested in: Human Brain Function Interfacing with the human brain and mind Developing solutions for paralyzed patients Who speaks? Brendan Allison, Bernhard Graimann, Eberhard Fetz, Beata Jarosiewicz, Jean-Philippe Lachaux, Eric Leuthardt, Phil Kennedy, Christa Neuper, Nick Ramsey, Gerwin Schalk, Bill Shain, Andrew Schwartz, Jonathan Wolpaw For more information, please visit www.bci2011.eu The 8th BCI2000 workshop What is this? A two-day workshop on Brain-Computer Interfacing and BCI2000 When and Where? Utrecht, Netherlands, May 18&19, 2011 By Whom? UMC Utrecht/Rudolf Magnus Institute and BCI2000 For Whom? Anyone interested in: Human Brain Function Interfacing with the human brain and mind Developing solutions for paralyzed patients Program: Lectures that describe relevant technical aspects of the BCI2000 system including implementation with C ++, Matlab, Fieldtrip or Python. Hands‐on practical tutorials where participants use BCI systems to control a cursor on a computer screen and to spell words just by thinking. Exercises, in which participants build and configure a BCI with their own signal processing methods, applications, or assistive devices. For more information, please visit www.bci2011.eu > De informatie opgenomen in dit bericht kan vertrouwelijk zijn en is uitsluitend bestemd voor de geadresseerde. Indien u dit bericht onterecht ontvangt, wordt u verzocht de inhoud niet te gebruiken en de afzender direct te informeren door het bericht te retourneren. Het Universitair Medisch Centrum Utrecht is een publiekrechtelijke rechtspersoon in de zin van de W.H.W. (Wet Hoger Onderwijs en Wetenschappelijk Onderzoek) en staat geregistreerd bij de Kamer van Koophandel voor Midden-Nederland onder nr. 30244197. Denk s.v.p aan het milieu voor u deze e-mail afdrukt. This message may contain confidential information and is intended exclusively for the addressee. If you receive this message unintentionally, please do not use the contents but notify the sender immediately by return e-mail. University Medical Center Utrecht is a legal person by public law and is registered at the Chamber of Commerce for Midden-Nederland under no. 30244197. Please consider the environment before printing this e-mail. -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: attbab2f.gif Type: image/gif Size: 15792 bytes Desc: not available URL: From luoj at mail.nih.gov Thu Apr 14 18:00:52 2011 From: luoj at mail.nih.gov (Luo, Jessie (NIH/NIMH) [C]) Date: Thu, 14 Apr 2011 12:00:52 -0400 Subject: [FieldTrip] FT_READ_EVENT Message-ID: Hi experts, Can FT_READ_EVENT handle 4D data (it does not seem to be so based on the documentation)? Working on getting fieldtrip to sort out different cognitive conditions based on trigger values. Any input or suggestion on what program to use is appreciated. Thanks, Jessie From daniele.marinazzo at ugent.be Thu Apr 14 20:53:08 2011 From: daniele.marinazzo at ugent.be (Daniele Marinazzo) Date: Thu, 14 Apr 2011 20:53:08 +0200 Subject: [FieldTrip] PhD position - analysis of neuroimaging data In-Reply-To: References: Message-ID: The PhD student will be part of a research group focusing on the development and validation of new methods for the analysis of neuroimaging data. The position is financed by the Multidisciplinary Research Project "The Integrative Neuroscience of Behavioural Control", an ambitious collaboration with experimental psychologists and clinical doctors. We are looking for a highly motivated candidate, who has ideally a master degree in physics, mathematics or engineering, knows at least one programming language (matlab, R, C, etc) and has an interest for multidisciplinary research. Anyway candidates with a medical/biological background and some programming expertise are also welcome to apply. If you wish to apply for this position, please send an email with a letter explaining why you wish to do research on this theme, a CV and publication list, if any, to Daniele Marinazzo (daniele.marinazzo at ugent.be). The selections will go on until the position is filled. For more information (including the details of the project proposal), please feel free to contact Daniele Marinazzo (daniele.marinazzo at ugent.be). -- Daniele Marinazzo -- http://www.da.ugent.be Department of Data Analysis, Gent University Henri Dunantlaan 1, B-9000 Gent, Belgium -------------- next part -------------- An HTML attachment was scrubbed... URL: From luoj at mail.nih.gov Thu Apr 14 21:35:32 2011 From: luoj at mail.nih.gov (Luo, Jessie (NIH/NIMH) [C]) Date: Thu, 14 Apr 2011 15:35:32 -0400 Subject: [FieldTrip] FT_READ_EVENT In-Reply-To: <7180e5c062dbf.4da6e0c2@mail.uh.edu> References: , <7180e5c062dbf.4da6e0c2@mail.uh.edu> Message-ID: Yes you are right. Thanks Mehmet! Jessie ________________________________________ From: mcoskun at mail.uh.edu [mcoskun at mail.uh.edu] Sent: Thursday, April 14, 2011 12:55 PM To: Luo, Jessie (NIH/NIMH) [C] Subject: Re: [FieldTrip] FT_READ_EVENT Hi Jessie, I have tried this long time ago and it does handle 4D data. I just checked the .m file for ft_read_event and 4D format is implemented actually. Mehmet ----- Original Message ----- From: "Luo, Jessie (NIH/NIMH) [C]" Date: Thursday, April 14, 2011 11:09 am Subject: [FieldTrip] FT_READ_EVENT To: "fieldtrip at donders.ru.nl" > Hi experts, > > Can FT_READ_EVENT handle 4D data (it does not seem to be so > based on the documentation)? Working on getting fieldtrip to > sort out different cognitive conditions based on trigger values. > Any input or suggestion on what program to use is appreciated. > > Thanks, > Jessie > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip From jan.schoffelen at donders.ru.nl Thu Apr 14 21:46:55 2011 From: jan.schoffelen at donders.ru.nl (jan-mathijs schoffelen) Date: Thu, 14 Apr 2011 21:46:55 +0200 Subject: [FieldTrip] FT_READ_EVENT In-Reply-To: References: Message-ID: <80088F6E-2E4E-40A2-A899-C90E023FECCD@donders.ru.nl> Hi Jessie, 4D data is fully supported in FieldTrip. If the documentation suggests otherwise, that's incorrect. To get started, you can have a look here: http://fieldtrip.fcdonders.nl/tutorial/preprocessing http://fieldtrip.fcdonders.nl/walkthrough Good luck, Jan-Mathijs On Apr 14, 2011, at 6:00 PM, Luo, Jessie (NIH/NIMH) [C] wrote: > Hi experts, > > Can FT_READ_EVENT handle 4D data (it does not seem to be so based on > the documentation)? Working on getting fieldtrip to sort out > different cognitive conditions based on trigger values. Any input or > suggestion on what program to use is appreciated. > > Thanks, > Jessie > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 From luoj at mail.nih.gov Thu Apr 14 21:55:34 2011 From: luoj at mail.nih.gov (Luo, Jessie (NIH/NIMH) [C]) Date: Thu, 14 Apr 2011 15:55:34 -0400 Subject: [FieldTrip] FT_READ_EVENT In-Reply-To: <80088F6E-2E4E-40A2-A899-C90E023FECCD@donders.ru.nl> References: , <80088F6E-2E4E-40A2-A899-C90E023FECCD@donders.ru.nl> Message-ID: Thanks Jan-Mathijs! Jessie ________________________________________ From: jan-mathijs schoffelen [jan.schoffelen at donders.ru.nl] Sent: Thursday, April 14, 2011 3:46 PM To: Email discussion list for the FieldTrip project Subject: Re: [FieldTrip] FT_READ_EVENT Hi Jessie, 4D data is fully supported in FieldTrip. If the documentation suggests otherwise, that's incorrect. To get started, you can have a look here: http://fieldtrip.fcdonders.nl/tutorial/preprocessing http://fieldtrip.fcdonders.nl/walkthrough Good luck, Jan-Mathijs On Apr 14, 2011, at 6:00 PM, Luo, Jessie (NIH/NIMH) [C] wrote: > Hi experts, > > Can FT_READ_EVENT handle 4D data (it does not seem to be so based on > the documentation)? Working on getting fieldtrip to sort out > different cognitive conditions based on trigger values. Any input or > suggestion on what program to use is appreciated. > > Thanks, > Jessie > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip From mcoskun at mail.uh.edu Fri Apr 15 08:58:07 2011 From: mcoskun at mail.uh.edu (Mehmet-Akif Coskun) Date: Fri, 15 Apr 2011 01:58:07 -0500 Subject: [FieldTrip] dipole waveform scale Message-ID: <7260941e607dc.4da7a62f@mail.uh.edu> Dear Fieldtrippers, The input data scaling for averaged data is in Tesla, but i wonder what is the units and the scale for dipole waveforms. When i checked the meg_leadfield1 m file, at the end leadfields are multiplied by 1e-7. Where this factor comes from? Thanks Mehmet Hope that helps. I'm thinking that if your gradiometer data scaling is in meters (check your grad structure) and the input data scaling to the last dot operation is in fT, then your output scale will be A-m (1e-9), but you might want to check since I didn't confirm that. I think by default the fieldtrip MEG data are in units of T so you might need to scale your input data accordingly to get your desired output scale. But then, I'm assuming MEG gradiometer data input, so if you have something else, check your function call to ft_compute_leadfield and adjust your scaling accordingly -------------- next part -------------- An HTML attachment was scrubbed... URL: From Hanneke.vanDijk at med.uni-duesseldorf.de Fri Apr 15 11:34:20 2011 From: Hanneke.vanDijk at med.uni-duesseldorf.de (Hanneke van Dijk) Date: Fri, 15 Apr 2011 11:34:20 +0200 Subject: [FieldTrip] I think you solved the problem In-Reply-To: <72E993C35FB11743B79FF9286E5B6D8B02676493@Mail2-UKD.VMED.UKD> References: <72E993C35FB11743B79FF9286E5B6D8B02676142@Mail2-UKD.VMED.UKD> <7B5CA863-D143-404C-BCB9-805AA6E6E546@donders.ru.nl> <72E993C35FB11743B79FF9286E5B6D8B02676264@Mail2-UKD.VMED.UKD> <72E993C35FB11743B79FF9286E5B6D8B026763B8@Mail2-UKD.VMED.UKD> <5AC469DB-D5B1-4E3C-AE21-01A53AE94A26@donders.ru.nl> <72E993C35FB11743B79FF9286E5B6D8B02676493@Mail2-UKD.VMED.UKD> Message-ID: Dear Jan and Jan-Mathijs, Thanks for working on this problem! I'm testing it for data recorded with the 'old' neuromag 122 system. I'm using the script that Jan attached to a previous e-mail, and the fieldtrip version that was released yesterday. The first question that I have is: What to do if you don't have fiducial information from the neuromag software? I could use ft_volume_realign with cfg.method = 'interactive' and point the fiducials out and swap the y and x axes. But in what coordinate system am I then, and in what coordinate system should I move on? second, My 'vol' , headmodel, seems to end up in a factor 10 (or more(?)) smaller unit then the grid and grad. You can't even see it in the headmodelplot (it is a small dot somewhere in the middle). I don't know what happened there. third, If you look at the picture I attached the grid is not in the centre of the helmet (pic1 from the top down), and very low (pic2 looking from the left). I don't know how to solve that. I at least think the subject was not in the helmet that way! Groetjes Hanneke -------------------------------------------------- Dr. Hanneke van Dijk Institut für Klinische Neurowissenschaften und Medizinische Psychologie Gebäude-Nr.: 23.02 Ebene: 03 Zimmer-Nr.: 47 Tel.: +49 211-81-13074 Mail : hanneke.vandijk at med.uni-duesseldorf.de http://www.uniklinik-duesseldorf.de/deutsch/unternehmen/institute/KlinNeurowiss/Team/HannekevanDijk/page.html On Thu, Apr 14, 2011 at 9:31 AM, wrote: > Dear Jan-Mathijs, > > > > sure, I will do that. I have tested one head model with > ft_dipole_simulation and beamforming and it looks good (at least when I > simulate two conditions and subtract sources the right location comes out). > So I guess we (and maybe others) will use the new procedure now. > > > > Best, > > jan > > > ------------------------------ > > *Von:* fieldtrip-bounces at donders.ru.nl [mailto: > fieldtrip-bounces at donders.ru.nl] *Im Auftrag von *jan-mathijs schoffelen > *Gesendet:* Mittwoch, 13. April 2011 16:57 > *An:* Email discussion list for the FieldTrip project > *Betreff:* Re: [FieldTrip] I think you solved the problem > > > > Dear Jan, > > > > No problem. Thanks for the script. If you feel up to it, you are kindly > invited to update the documentation on the fieldtrip wiki as well. If I > recall correctly, at some point Hanneke added some documentation about how > to create MNI-based dipole grids for neuromag data. A lot of the > intermediate steps have now become obsolete and this part of the wiki can be > substantially cleaned. > > > > Thanks, > > > > Jan-Mathijs > > > > > > On Apr 13, 2011, at 2:31 PM, < > Jan.Hirschmann at med.uni-duesseldorf.de> wrote: > > > > Dear Jan-Mathijs, > > > > I think we solved the problem. Everthing is like you said in the first > place. ft_volumerealign and ft_volumesegment should be called with > cfg.coordsys=’neuromag’. The only thing that was wrong is that for the voxel > coordinates read from the Neuromag GUI x and y should be swapped. For anyone > interested I attach a script that is meant to be easy-to-use for beginners. > > > > Thank you very much for your time! > ------------------------------ > > *Von:* fieldtrip-bounces at donders.ru.nl [ > mailto:fieldtrip-bounces at donders.ru.nl ] > *Im Auftrag von *jan-mathijs schoffelen > *Gesendet:* Dienstag, 12. April 2011 21:18 > *An:* Email discussion list for the FieldTrip project > *Betreff:* Re: [FieldTrip] I think you solved the problem > > > > Dear Jan, > > > > I suspect that your mri, as it comes out of ft_read_mri is already > coregistered in neuromag space. After your realignment and after replacing > mri.transform with real_mri.transform, the coordinate axes in your pic1 look > strange. This I think causes the 'dropped pocket change'. > > What happens if you skip the ft_volumerealign step and call > ft_volumesegment directly on the mri (with cfg.coordsys = 'neuromag', or, > for what it's worth, without cfg.coordsys; in this case you will be able to > verify the coordinate system)? > > Alternatively, if this doesn't work, could you replace mri.transform by > eye(4) prior to calling ft_volumerealign and ft_volumesegment (both with > cfg.coordsys = 'neuromag' and no further tampering with transformation > matrices?). > > > > Thanks > > > > JM > > > > > > On Apr 12, 2011, at 8:49 PM, < > Jan.Hirschmann at med.uni-duesseldorf.de> wrote: > > > > > Dear Jan-Mathijs, > > > > sorry, I think I was a bit too enthusiastic when I said everything worked > out wonderfully. It worked only once. After an afternoon of confusion I > concluded that on my first try I must have misspelled > cfg.coordsys=’neuromag’ on my calls to ft_volumerealign and > ft_volumesegment. In fact, the segmentation looks really bad with these > settings. What works for me is written underneath: > > > > mri = ft_read_mri('….fif'); > > hdr=ft_read_header('…fif'); > > mri.anatomy=double(mri.anatomy); > > > > %this is taken from the Neuromag GUI for MRI-MEG Integration > > cfg=[]; > > cfg.fiducial.rpa=[136.35 142.80 31.96]; > > cfg.fiducial.nas=[47.84 101.80 100.10]; > > cfg.fiducial.lpa=[139.22 146.17 162.69]; > > > > %go from neuromag voxel to neuromag head coordinates > > cfg.coordsys='neuromag'; > > cfg.method='fiducial'; > > real_mri=ft_volumerealign(cfg,mri); > > > > %taking real_mri with its coordsys field will not work, so I take mri > > mri.transform=real_mri.transform; > > > > cfg = []; > > cfg.keepintermediate = 'no'; > > cfg.write = 'no'; > > segmentedmri = ft_volumesegment(cfg, mri); > > > > > > Before segmentation the function shows some kind of brain (pic 1). When > segmentation is done the segmented brain looks good (pic 2) but the brain > does not fit the helmet (pic 3). It is looking at its feet as if it dropped > some pocket change. Do you know what is going on? > > > > Thanks, > > jan > > > ------------------------------ > > *Von:* fieldtrip-bounces at donders.ru.nl [ > mailto:fieldtrip-bounces at donders.ru.nl ] > *Im Auftrag von *jan-mathijs schoffelen > *Gesendet:* Dienstag, 12. April 2011 12:11 > *An:* Email discussion list for the FieldTrip project > *Betreff:* Re: [FieldTrip] I think you solved the problem > > > > Dear Jan, > > > > Apart from not being properly aligned, the segmentation looks a bit strange > to me. I suspect that not everything went well here ;o). > > Could you try the following: > > > > specify cfg.coordsys = 'neuromag', both in your call to ft_volumerealign > and in your call to ft_volumesegment. The cfg.coordinates for > ft_volumesegment has to be removed (actually it is a deprecated option). The > idea now is that mri-structures in fieldtrip can have a coordsys field, > which allows for more transparent use of the different head coordinate > system conventions. This takes away the need for intermediately > coregistering the MRI in 'ctf'-convention, and would also take away your > need to call headcoordinates later on. > > > > Best wishes, > > > > Jan-Mathijs > > > > > > On Apr 12, 2011, at 11:07 AM, < > Jan.Hirschmann at med.uni-duesseldorf.de> wrote: > > > > > > Dear fieldtrip experts, > > > > I have two questions regarding head model creation. As noted on this > thread, the volumesegment function was updated and I tested it for our > Neuromag data. The segmentation is performed, but unfortunately it is not > aligned with the MRI in my case. Here is the code I am using, the fieldtrip > is from 9th April 2011. > > > > %read mri > > mri = ft_read_mri(subject_files.fiff_mri); > > mri.anatomy=double(mri.anatomy); > > > > %these are the fiducials for this subject taken from the Neuromag GUI for > coregistration > > cfg=[]; > > cfg.fiducial.rpa=[136.35 142.80 31.96]; > > cfg.fiducial.nas=[47.84 101.80 100.10]; > > cfg.fiducial.lpa=[139.22 146.17 162.69]; > > > > %define the head coordinate system according to CTF conventions > > cfg.method='fiducial'; > > real_mri=ft_volumerealign(cfg,mri); > > > > %segment > > cfg = []; > > cfg.template = '/data/apps/spm/spm8/templates/T1.nii'; > > cfg.coordinates = 'ctf'; > > cfg.keepintermediate = 'no'; > > segmentedmri = ft_volumesegment(cfg, real_mri); > > > > %plot white matter > > test=segmentedmri; > > test.anatomy=real_mri.anatomy; > > cfg=[]; > > cfg.funparameter='white'; > > ft_sourceplot(cfg,test); %see attached picture > > > > The other issue regards back-transformation from CTF to Neuromag > coordinates, which is necessary to make the head model fit the sensors. My > idea was to create an appropriate transformation matrix like this. > > > > cd /net/avidya/storage/home/jan/fieldtrip-20110409/private > > ctfmat=headcoordinates(nas,lpa,rpa,'ctf'); > > nmmat=headcoordinates(nas,lpa,rpa,'neuromag'); > > ctf_to_nm=nmmat/ctfmat; > > > > > > And then to use it on the head model to bring it back into Neuromag > coordinates: > > > > %create single shell, realistic headmodel > > cfg = []; > > hdm = ft_prepare_singleshell(cfg,segmentedmri); > > > > % transformation of headmodel into Neuromag space > > hdm.bnd.pnt=warp_apply(ctf_to_nm,hdm.bnd.pnt,'homogeneous'); > > > > Does this survive a sanity check? > > > > Best regards and thanks a lot, > > > > Jan > > > > > ------------------------------ > > *Von:* fieldtrip-bounces at donders.ru.nl [ > mailto:fieldtrip-bounces at donders.ru.nl ] > *Im Auftrag von *Jen Whitman > *Gesendet:* Montag, 28. Februar 2011 22:32 > *An:* Email discussion list for the FieldTrip project > *Betreff:* [FieldTrip] I think you solved the problem > > > > I just checked, and when I re-ran my segmentation script with the new > Fieldtrip in order to use an spm8 template image, coordinates got reversed. > When I take out the calls to flipdim, they look fine (see attached > screenshots). That certainly explains the meaningless results I was getting! > > Thanks for figuring that out, > > Jen > > On Mon, Feb 28, 2011 at 12:36 PM, jan-mathijs schoffelen < > jan.schoffelen at donders.ru.nl> wrote: > > Hi Jen, > > > > At first glance I have a comment on your script. You may need to explicitly > check the alignment of your segmented volume and the original anatomy. A > while a go some changes were made to ft_volumesegment, taking away the need > to do the flipdim(flipdim... operations. I have posted this on the > discussion list last January, but you may not have noticed. > > Anyway, if you now have used a recent version of FieldTrip for your > segmentation both the location of your dipole grid, and the volume conductor > model will not be adequately coregistered with the data, which may lead to > funky results to begin with. That's most likely not related to the filetype > in which the volumes are saved for later use. > > > > Best wishes, > > > > Jan-Mathijs > > > > > > > > On Feb 28, 2011, at 8:59 PM, Jen Whitman wrote: > > > > > > > Hello Jan, > > When calling volumesegment, I specified 'ctf' as the coordinate system. The > function I wrote to call volumesegment and prepare_singleshell for each > subject and save the results is pasted below, with a couple of comments > added for clarity. > Over the weekend I tried specifying the coordinate system in the call to > ft_volumenormalise as 'ctf' rather than 'spm', and commented out all the > lines that said cfg.spmversion = 'spm8'; before calling a function. However, > that created worse results, as each plot involved stripes of activation and > empty voxels, suggesting that 'ctf' was not the correct coordinate system to > specify. > > Thanks for the attached script. Looking in that the comments in that, I > suspect that the solution to my problems will be to specify my filetype as > nifti_img rather than nifti. I'll let you know how that goes. > > Jen > > > ------------------------------------------------------------------------------------------------------------ > % the variable subj is simply a string consisting of a subject number (e.g. > 's05') which can be a folder name or part of a filename > function [vol mri segmentedmri > segmentedmriF]=call_volume_segment_function_spm8(subj) > cfg.spmversion = 'spm8'; > cfg.template = '/home/woodwardlab/spm8/templates/EPI.nii'; > %cfg.template='/home/common/matlab/spm2/templates/T1.mnc'; > cfg.name=[subj '_volseg']; > cfg.write='yes'; > cfg.smooth='no'; > cfg.coordinates='ctf'; > mri=read_mri([subj '/mri/' subj 'head.mri']); % made with CTF mriConverter > and mriViewer software, after fiducials were marked > segmentedmri = volumesegment(cfg, mri); > segmentedmriF = segmentedmri; > segmentedmriF.gray = flipdim(flipdim(flipdim(segmentedmriF.gray,3),2),1); > segmentedmriF.white = flipdim(flipdim(flipdim(segmentedmriF.white,3),2),1); > segmentedmriF.csf = flipdim(flipdim(flipdim(segmentedmriF.csf,3),2),1); > segmentedmriF.transform = mri.transform; > segmentedmriF.anatomy = mri.anatomy; > cfg = []; > cfg.spmversion = 'spm8'; > vol = prepare_singleshell(cfg, segmentedmriF); > eval(['save ' subj '/meg/mrisegmented.mat mri segmentedmri segmentedmriF > vol']) > > > > > > On Sat, Feb 26, 2011 at 5:26 AM, jan-mathijs schoffelen < > jan.schoffelen at donders.ru.nl> wrote: > > Dear Jen, > > > > I do not manage to reproduce your issue, when only focussing on the > ft_volumewrite and visualization part of your pipeline. See attached script, > and yet an updated version of ft_volumewrite which you need to (hopefully) > draw the same conclusion as I did. > > Yet, I only now realize that your question may pertain to the entire > pipeline. It could be that something is going wrong there. > > I only see now that in the part of your script of which you reported that > it gave 'good' results, you specify cfg.coordinates = 'ctf' before calling > ft_volumenormalise. I assume this is correct, because the coordinate system > your source-reconstructed data lives in, is according to the CTF-convention, > and not according to the SPM-convention. On the other hand, the template for > the spatial normalization lives in the SPM-coordinate system. In order for > the spatial normalization to work OK, Fieldtrip tries to convert from one > coordinate system to the other (once again, this is appropriate behaviour), > before doing the actual normalization. It seems that at least in the script > you sent along, in the final (not working version), you specified > cfg.coordinates = 'spm' prior to calling ft_volumenormalise. This is > probably wrong. > > Another important point that should be mentioned, is that the coordinate > systems in which the functional data and the anatomical data live should be > the same for the ft_sourceinterpolate to make sense. In other words, if your > source reconstructed images are defined on a 3D grid of positions in > CTF-space, the mri.transform of your anatomy should describe a > transformation from voxel to CTF-space. > > I think you may want to revisit step by step this part of the pipeline; I > don't think the problem lies in the writing. > > A final possibility of course is that Mricron is misbehaving... > > > > Best, > > > > Jan-Mathijs > > > > > > > > > > > > > > On Feb 25, 2011, at 9:44 PM, Jen Whitman wrote: > > > > > > > Hi Jan, > > I tried re-running the analysis with the new script you sent me, and the > latest version of fieldtrip (since I needed ft_get_opt as well), but the > spm8 images being written are still producing flawed results. It's the same > problem as I mentioned briefly in my previous post. I am not getting any > error messages when writing these images. Rather, my problem is that the > spm8 and spm2 results from the same data ought to be identical when viewed > in mricron, but they're far from it. When I use mricron to look at the > results from the spm8-format images, combined across participants to create > a t-image, I just get a single 'blob' spanning roughly half the brain. In > contrast, when I used spm2-format previously on the same data, the t-image > was much more meaningful; a posterior alpha power decrease in a set of > regions corresponding to the 'task-positive network' (a network found in the > results of an fMRI version of my experiment, and widely reported in the fMRI > literature). > > This failure to replicate the spm2 results when using spm8 images from the > same data leads me to suspect that something is wrong with the coordinates > for spm8 format. However, after experimenting extensively with different cfg > options I still haven't identified the problem. If I my structural MRIs have > been saved to .mri files using CTF's MRIConverter program, which cfg > options, particularly for coordinates, template images, and filetypes, > should I specify before calling the ft_volumesegment, > ft_prepare_singleshell, ft_sourceinterpolate, ft_volumenormalise, and > ft_volumewrite functions? Or should I be calling a different set of > functions now? > > Thanks again for your help, > > Jen > > On Thu, Feb 24, 2011 at 10:07 AM, Jen Whitman > wrote: > > Great, thanks! > > I'll start the analysis with your new script today and will let you know > how it works out. > > Jen > > On Thu, Feb 24, 2011 at 4:44 AM, jan-mathijs schoffelen < > jan.schoffelen at donders.ru.nl> wrote: > > Dear Jen, > > > > I managed to reproduce your problem. The code was rather buggy and indeed > ft_volumewrite did not behave as it should have. I now fixed it in the code > and it should run fine now. Please find the updated file attached. It will > be available on our ftp-server as of tonight. Please note that I updated the > documentation, and changed the names of some of the options a bit. If you > want to save your data in analyze-format, you should specify cfg.filetype = > 'analyze_spm'. If you specify cfg.filetype = 'nifti', it should write out a > volume to nifti-format, using SPM8. > > > > Best wishes, > > > > Jan-Mathijs > > > > > > > > > > > > On Feb 23, 2011, at 7:44 PM, Jen Whitman wrote: > > > > > Dear Jan, > > Thanks for the quick reply. Yes, I have tried it out quite a few times now, > experimenting with different settings in the cfgs. Below I'll paste the code > I've been using to write images - first the code that successfully created > spm2 images that produced good results, then the code used for creating > nifti format images from the same data. The comments in this second part are > at this point a bit of a maze of cfg options I've been changing back & > forth. Any insights/suggestions regarding how to set up my cfgs to make this > work would be greatly appreciated. > > Jen > > > %%%%%%%% this code generated spm2-compatible images which did work > (producing results that made sense). > > %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% > > sourcetemp.avg.pow = (sourcetemp.avg.pow - sourcePre.avg.pow) ./ > sourcePre.avg.pow; > > cfg = []; > cfg.downsample = 2; > sourcetempInt = sourceinterpolate(cfg, sourcetemp , mri); > > % projecting the plot onto a surface... > cfg = []; > cfg.coordinates = 'ctf'; > cfg.template = '/home/common/matlab/spm2/templates/T1.mnc'; %this > template is in MNI coordinates > sourcetempIntN = volumenormalise(cfg, sourcetempInt); > > filename=[subj 'run' int2str(r) 'cond' int2str(cond) '_' int2str(f) > 'HzWin' int2str(win) 'width750ms']; > cfg=[]; > cfg.parameter = 'avg.pow'; % string, describing the functional data > to be processed, e.g. 'pow', 'coh' or 'nai' > cfg.filename = [filename '.img']; %'testimageoutput_alphafreq'; % > filename without the extension > cfg.filetype = 'spm'; %'analyze', 'spm', 'vmp' or 'vmr' > cfg.coordinates = 'spm'; %'spm, 'ctf' or empty for interactive > (default = []) > cfg.datatype = 'double'; %'float'; %'double'; %'bit1', 'uint8', > 'int16', 'int32', 'float' or 'double' > > volumewrite(cfg, sourcetempIntN) > > > > %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% > > %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% > > %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% > > %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% > %%%%% this code below hasn't worked yet... > > % I added cfg.spmversion = 'spm8'; > % in the cfgs for the calls to ft_prepare_leadfield and ft_sourceanalysis, > % and in the call to prepare_singleshell after calling volumesegment > > % I've also ensured that spm8 is the only spm version in my path, even in > % the fieldtrip/external folder, and ensured that spm8 is installed > properly > % (files compiled correctly, etc..) > > sourcetemp.avg.pow = (sourcetemp.avg.pow - sourcePre.avg.pow) ./ > sourcePre.avg.pow; > > filename=[subj 'run' int2str(r) 'cond' int2str(cond) '_' int2str(f) > 'Hzspm8_FIXv9_Win' int2str(win) 'width750ms.img']; > > cfg = []; > % cfg.coordinates = 'spm'; % changed for version 5 > % cfg.spmversion = 'spm8'; % changed for version 5 > cfg.downsample = 4; > sourcetempInt = ft_sourceinterpolate(cfg, sourcetemp , mri); > > > % projecting the plot onto a surface... > cfg = []; > %cfg.coordinates = 'spm'; % changed for version 5 > %cfg.coordinates = 'ctf'; % changed for version 5 > cfg.coordinates = 'spm'; % changed back to spm for version 9 > cfg.downsample = 4; > %cfg.spmversion = 'spm8'; % changed for version 6 (because this gets > specified in volumewrite) > cfg.template = 'Hmatrix/mask.nii.nii'; % basically equivalent to using > spm8/templates/EPI.nii, except that mask.nii (produced from fmri data) has > the desired voxel size > % cfg.name = [filename]; % changed for version 6 > %cfg.write= 'yes'; % changed for version 6 (when this was set to 'yes' > there was no subsequent call to volumewrite) > cfg.write= 'no'; % changed for version 6 > sourcetempIntN = ft_volumenormalise(cfg, sourcetempInt); > > % this whole cfg and function call added for version 6 > cfg=[]; > % cfg.parameter = string, describing the functional data to be > processed, e.g. 'pow', 'coh' or 'nai' > % cfg.filename = filename without the extension > % cfg.filetype = 'analyze', 'spm', 'vmp' or 'vmr' > % cfg.vmpversion = 1 or 2 (default) version of the vmp-format to use > % cfg.coordinates = 'spm, 'ctf' or empty for interactive (default = []) > cfg.parameter='pow'; > cfg.filename=filename; > cfg.filetype = 'spm'; > cfg.spmversion = 'SPM8'; % capitalized after first error message from > vers 6 > % cfg.dataformat='nifti'; % added after first error message from vers 6 > % commented out after 2nd error message > from vers 6 > %cfg.vmpversion=2; % this is a filetype, like spm, so don't need to > specify unless cfg.filetyp='vmp' > cfg.coordinates='spm'; > ft_volumewrite(cfg,sourcetempIntN); > > > > > > > > On Wed, Feb 23, 2011 at 7:50 AM, jan-mathijs schoffelen < > jan.schoffelen at donders.ru.nl> wrote: > > Dear Jen, > > I notice that indeed in the documentation section of ft_write_volume there > is a FIXME behind nifti. Yet, nifti format seems to be supported by > ft_write_volume (at least in a recent version of fieldtrip). Did you try it > at all (and ran into problems) or were you held back by the FIXME statement? > Could you just try it out using a recent fieldtrip function? > > Thanks and best wishes > > Jan-Mathijs > > > > > On Feb 23, 2011, at 2:21 AM, Jen Whitman wrote: > > Hello, > > While writing beamformed images to spm2 format in a previous version of > fieldtrip (now lost due to a computer crash), I was able to get nice-looking > results; networks of brain regions consistent with existing literature. When > I try to write images from the same dataset and the same analysis to spm8 > format, my results (t-images computed across subjects) end up being single > clusters spanning large sections of the brain (e.g. a 'blob' spanning all of > one hemisphere but not the other). Unfortunately, some aspects of my planned > data analyses cannot be performed on spm2 images, so I have to find a way of > writing to successfully to nifti format. > > I just noticed that in the comments in the ft_write_volume function, which > I am calling via ft_volumewrite, it says 'FIXME' next to nifti under the > list of supported dataformats. Is there by any chance a patch out there for > writing nifti images? > > Thanks! > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > > > Dr. J.M. (Jan-Mathijs) Schoffelen > Donders Institute for Brain, Cognition and Behaviour, > Centre for Cognitive Neuroimaging, > Radboud University Nijmegen, The Netherlands > J.Schoffelen at donders.ru.nl > Telephone: 0031-24-3614793 > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > > > > Dr. J.M. (Jan-Mathijs) Schoffelen > > Donders Institute for Brain, Cognition and Behaviour, > Centre for Cognitive Neuroimaging, > Radboud University Nijmegen, The Netherlands > > J.Schoffelen at donders.ru.nl > > Telephone: 0031-24-3614793 > > > > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > > > > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > > > > Dr. J.M. (Jan-Mathijs) Schoffelen > > Donders Institute for Brain, Cognition and Behaviour, > Centre for Cognitive Neuroimaging, > Radboud University Nijmegen, The Netherlands > > J.Schoffelen at donders.ru.nl > > Telephone: 0031-24-3614793 > > > > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > > > > Dr. J.M. (Jan-Mathijs) Schoffelen > > Donders Institute for Brain, Cognition and Behaviour, > Centre for Cognitive Neuroimaging, > Radboud University Nijmegen, The Netherlands > > J.Schoffelen at donders.ru.nl > > Telephone: 0031-24-3614793 > > > > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > > > > > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > > > > Dr. J.M. (Jan-Mathijs) Schoffelen > > Donders Institute for Brain, Cognition and Behaviour, > Centre for Cognitive Neuroimaging, > Radboud University Nijmegen, The Netherlands > > J.Schoffelen at donders.ru.nl > > Telephone: 0031-24-3614793 > > > > > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > > > > Dr. J.M. (Jan-Mathijs) Schoffelen > > Donders Institute for Brain, Cognition and Behaviour, > Centre for Cognitive Neuroimaging, > Radboud University Nijmegen, The Netherlands > > J.Schoffelen at donders.ru.nl > > Telephone: 0031-24-3614793 > > > > > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > > > > Dr. J.M. (Jan-Mathijs) Schoffelen > > Donders Institute for Brain, Cognition and Behaviour, > Centre for Cognitive Neuroimaging, > Radboud University Nijmegen, The Netherlands > > J.Schoffelen at donders.ru.nl > > Telephone: 0031-24-3614793 > > > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: pic1.jpg Type: image/jpeg Size: 22308 bytes Desc: not available URL: From Hanneke.vanDijk at med.uni-duesseldorf.de Fri Apr 15 12:38:56 2011 From: Hanneke.vanDijk at med.uni-duesseldorf.de (Hanneke van Dijk) Date: Fri, 15 Apr 2011 12:38:56 +0200 Subject: [FieldTrip] I think you solved the problem In-Reply-To: References: <72E993C35FB11743B79FF9286E5B6D8B02676142@Mail2-UKD.VMED.UKD> <7B5CA863-D143-404C-BCB9-805AA6E6E546@donders.ru.nl> <72E993C35FB11743B79FF9286E5B6D8B02676264@Mail2-UKD.VMED.UKD> <72E993C35FB11743B79FF9286E5B6D8B026763B8@Mail2-UKD.VMED.UKD> <5AC469DB-D5B1-4E3C-AE21-01A53AE94A26@donders.ru.nl> <72E993C35FB11743B79FF9286E5B6D8B02676493@Mail2-UKD.VMED.UKD> Message-ID: sorry, forgot to attach pic2 On Fri, Apr 15, 2011 at 11:34 AM, Hanneke van Dijk < Hanneke.vanDijk at med.uni-duesseldorf.de> wrote: > Dear Jan and Jan-Mathijs, > > Thanks for working on this problem! I'm testing it for data recorded with > the 'old' neuromag 122 system. I'm using the script that Jan attached to a > previous e-mail, and the fieldtrip version that was released yesterday. The > first question that I have is: > > What to do if you don't have fiducial information from the neuromag > software? I could use ft_volume_realign with cfg.method = 'interactive' and > point the fiducials out and swap the y and x axes. But in what coordinate > system am I then, and in what coordinate system should I move on? > > second, > > My 'vol' , headmodel, seems to end up in a factor 10 (or more(?)) smaller > unit then the grid and grad. You can't even see it in the headmodelplot (it > is a small dot somewhere in the middle). I don't know what happened there. > > third, > > If you look at the picture I attached the grid is not in the centre of the > helmet (pic1 from the top down), and very low (pic2 looking from the left). > I don't know how to solve that. I at least think the subject was not in the > helmet that way! > > Groetjes Hanneke > > -------------------------------------------------- > Dr. Hanneke van Dijk > Institut für Klinische Neurowissenschaften und Medizinische Psychologie > Gebäude-Nr.: 23.02 > Ebene: 03 Zimmer-Nr.: 47 > Tel.: +49 211-81-13074 > Mail : hanneke.vandijk at med.uni-duesseldorf.de > > http://www.uniklinik-duesseldorf.de/deutsch/unternehmen/institute/KlinNeurowiss/Team/HannekevanDijk/page.html > > > On Thu, Apr 14, 2011 at 9:31 AM, wrote: > >> Dear Jan-Mathijs, >> >> >> >> sure, I will do that. I have tested one head model with >> ft_dipole_simulation and beamforming and it looks good (at least when I >> simulate two conditions and subtract sources the right location comes out). >> So I guess we (and maybe others) will use the new procedure now. >> >> >> >> Best, >> >> jan >> >> >> ------------------------------ >> >> *Von:* fieldtrip-bounces at donders.ru.nl [mailto: >> fieldtrip-bounces at donders.ru.nl] *Im Auftrag von *jan-mathijs schoffelen >> *Gesendet:* Mittwoch, 13. April 2011 16:57 >> *An:* Email discussion list for the FieldTrip project >> *Betreff:* Re: [FieldTrip] I think you solved the problem >> >> >> >> Dear Jan, >> >> >> >> No problem. Thanks for the script. If you feel up to it, you are kindly >> invited to update the documentation on the fieldtrip wiki as well. If I >> recall correctly, at some point Hanneke added some documentation about how >> to create MNI-based dipole grids for neuromag data. A lot of the >> intermediate steps have now become obsolete and this part of the wiki can be >> substantially cleaned. >> >> >> >> Thanks, >> >> >> >> Jan-Mathijs >> >> >> >> >> >> On Apr 13, 2011, at 2:31 PM, < >> Jan.Hirschmann at med.uni-duesseldorf.de> wrote: >> >> >> >> Dear Jan-Mathijs, >> >> >> >> I think we solved the problem. Everthing is like you said in the first >> place. ft_volumerealign and ft_volumesegment should be called with >> cfg.coordsys=’neuromag’. The only thing that was wrong is that for the voxel >> coordinates read from the Neuromag GUI x and y should be swapped. For anyone >> interested I attach a script that is meant to be easy-to-use for beginners. >> >> >> >> Thank you very much for your time! >> ------------------------------ >> >> *Von:* fieldtrip-bounces at donders.ru.nl [ >> mailto:fieldtrip-bounces at donders.ru.nl ] >> *Im Auftrag von *jan-mathijs schoffelen >> *Gesendet:* Dienstag, 12. April 2011 21:18 >> *An:* Email discussion list for the FieldTrip project >> *Betreff:* Re: [FieldTrip] I think you solved the problem >> >> >> >> Dear Jan, >> >> >> >> I suspect that your mri, as it comes out of ft_read_mri is already >> coregistered in neuromag space. After your realignment and after replacing >> mri.transform with real_mri.transform, the coordinate axes in your pic1 look >> strange. This I think causes the 'dropped pocket change'. >> >> What happens if you skip the ft_volumerealign step and call >> ft_volumesegment directly on the mri (with cfg.coordsys = 'neuromag', or, >> for what it's worth, without cfg.coordsys; in this case you will be able to >> verify the coordinate system)? >> >> Alternatively, if this doesn't work, could you replace mri.transform by >> eye(4) prior to calling ft_volumerealign and ft_volumesegment (both with >> cfg.coordsys = 'neuromag' and no further tampering with transformation >> matrices?). >> >> >> >> Thanks >> >> >> >> JM >> >> >> >> >> >> On Apr 12, 2011, at 8:49 PM, < >> Jan.Hirschmann at med.uni-duesseldorf.de> wrote: >> >> >> >> >> Dear Jan-Mathijs, >> >> >> >> sorry, I think I was a bit too enthusiastic when I said everything worked >> out wonderfully. It worked only once. After an afternoon of confusion I >> concluded that on my first try I must have misspelled >> cfg.coordsys=’neuromag’ on my calls to ft_volumerealign and >> ft_volumesegment. In fact, the segmentation looks really bad with these >> settings. What works for me is written underneath: >> >> >> >> mri = ft_read_mri('….fif'); >> >> hdr=ft_read_header('…fif'); >> >> mri.anatomy=double(mri.anatomy); >> >> >> >> %this is taken from the Neuromag GUI for MRI-MEG Integration >> >> cfg=[]; >> >> cfg.fiducial.rpa=[136.35 142.80 31.96]; >> >> cfg.fiducial.nas=[47.84 101.80 100.10]; >> >> cfg.fiducial.lpa=[139.22 146.17 162.69]; >> >> >> >> %go from neuromag voxel to neuromag head coordinates >> >> cfg.coordsys='neuromag'; >> >> cfg.method='fiducial'; >> >> real_mri=ft_volumerealign(cfg,mri); >> >> >> >> %taking real_mri with its coordsys field will not work, so I take mri >> >> mri.transform=real_mri.transform; >> >> >> >> cfg = []; >> >> cfg.keepintermediate = 'no'; >> >> cfg.write = 'no'; >> >> segmentedmri = ft_volumesegment(cfg, mri); >> >> >> >> >> >> Before segmentation the function shows some kind of brain (pic 1). When >> segmentation is done the segmented brain looks good (pic 2) but the brain >> does not fit the helmet (pic 3). It is looking at its feet as if it dropped >> some pocket change. Do you know what is going on? >> >> >> >> Thanks, >> >> jan >> >> >> ------------------------------ >> >> *Von:* fieldtrip-bounces at donders.ru.nl [ >> mailto:fieldtrip-bounces at donders.ru.nl ] >> *Im Auftrag von *jan-mathijs schoffelen >> *Gesendet:* Dienstag, 12. April 2011 12:11 >> *An:* Email discussion list for the FieldTrip project >> *Betreff:* Re: [FieldTrip] I think you solved the problem >> >> >> >> Dear Jan, >> >> >> >> Apart from not being properly aligned, the segmentation looks a bit >> strange to me. I suspect that not everything went well here ;o). >> >> Could you try the following: >> >> >> >> specify cfg.coordsys = 'neuromag', both in your call to ft_volumerealign >> and in your call to ft_volumesegment. The cfg.coordinates for >> ft_volumesegment has to be removed (actually it is a deprecated option). The >> idea now is that mri-structures in fieldtrip can have a coordsys field, >> which allows for more transparent use of the different head coordinate >> system conventions. This takes away the need for intermediately >> coregistering the MRI in 'ctf'-convention, and would also take away your >> need to call headcoordinates later on. >> >> >> >> Best wishes, >> >> >> >> Jan-Mathijs >> >> >> >> >> >> On Apr 12, 2011, at 11:07 AM, < >> Jan.Hirschmann at med.uni-duesseldorf.de> wrote: >> >> >> >> >> >> Dear fieldtrip experts, >> >> >> >> I have two questions regarding head model creation. As noted on this >> thread, the volumesegment function was updated and I tested it for our >> Neuromag data. The segmentation is performed, but unfortunately it is not >> aligned with the MRI in my case. Here is the code I am using, the fieldtrip >> is from 9th April 2011. >> >> >> >> %read mri >> >> mri = ft_read_mri(subject_files.fiff_mri); >> >> mri.anatomy=double(mri.anatomy); >> >> >> >> %these are the fiducials for this subject taken from the Neuromag GUI for >> coregistration >> >> cfg=[]; >> >> cfg.fiducial.rpa=[136.35 142.80 31.96]; >> >> cfg.fiducial.nas=[47.84 101.80 100.10]; >> >> cfg.fiducial.lpa=[139.22 146.17 162.69]; >> >> >> >> %define the head coordinate system according to CTF conventions >> >> cfg.method='fiducial'; >> >> real_mri=ft_volumerealign(cfg,mri); >> >> >> >> %segment >> >> cfg = []; >> >> cfg.template = '/data/apps/spm/spm8/templates/T1.nii'; >> >> cfg.coordinates = 'ctf'; >> >> cfg.keepintermediate = 'no'; >> >> segmentedmri = ft_volumesegment(cfg, real_mri); >> >> >> >> %plot white matter >> >> test=segmentedmri; >> >> test.anatomy=real_mri.anatomy; >> >> cfg=[]; >> >> cfg.funparameter='white'; >> >> ft_sourceplot(cfg,test); %see attached picture >> >> >> >> The other issue regards back-transformation from CTF to Neuromag >> coordinates, which is necessary to make the head model fit the sensors. My >> idea was to create an appropriate transformation matrix like this. >> >> >> >> cd /net/avidya/storage/home/jan/fieldtrip-20110409/private >> >> ctfmat=headcoordinates(nas,lpa,rpa,'ctf'); >> >> nmmat=headcoordinates(nas,lpa,rpa,'neuromag'); >> >> ctf_to_nm=nmmat/ctfmat; >> >> >> >> >> >> And then to use it on the head model to bring it back into Neuromag >> coordinates: >> >> >> >> %create single shell, realistic headmodel >> >> cfg = []; >> >> hdm = ft_prepare_singleshell(cfg,segmentedmri); >> >> >> >> % transformation of headmodel into Neuromag space >> >> hdm.bnd.pnt=warp_apply(ctf_to_nm,hdm.bnd.pnt,'homogeneous'); >> >> >> >> Does this survive a sanity check? >> >> >> >> Best regards and thanks a lot, >> >> >> >> Jan >> >> >> >> >> ------------------------------ >> >> *Von:* fieldtrip-bounces at donders.ru.nl [ >> mailto:fieldtrip-bounces at donders.ru.nl ] >> *Im Auftrag von *Jen Whitman >> *Gesendet:* Montag, 28. Februar 2011 22:32 >> *An:* Email discussion list for the FieldTrip project >> *Betreff:* [FieldTrip] I think you solved the problem >> >> >> >> I just checked, and when I re-ran my segmentation script with the new >> Fieldtrip in order to use an spm8 template image, coordinates got reversed. >> When I take out the calls to flipdim, they look fine (see attached >> screenshots). That certainly explains the meaningless results I was getting! >> >> Thanks for figuring that out, >> >> Jen >> >> On Mon, Feb 28, 2011 at 12:36 PM, jan-mathijs schoffelen < >> jan.schoffelen at donders.ru.nl> wrote: >> >> Hi Jen, >> >> >> >> At first glance I have a comment on your script. You may need to >> explicitly check the alignment of your segmented volume and the original >> anatomy. A while a go some changes were made to ft_volumesegment, taking >> away the need to do the flipdim(flipdim... operations. I have posted this >> on the discussion list last January, but you may not have noticed. >> >> Anyway, if you now have used a recent version of FieldTrip for your >> segmentation both the location of your dipole grid, and the volume conductor >> model will not be adequately coregistered with the data, which may lead to >> funky results to begin with. That's most likely not related to the filetype >> in which the volumes are saved for later use. >> >> >> >> Best wishes, >> >> >> >> Jan-Mathijs >> >> >> >> >> >> >> >> On Feb 28, 2011, at 8:59 PM, Jen Whitman wrote: >> >> >> >> >> >> >> Hello Jan, >> >> When calling volumesegment, I specified 'ctf' as the coordinate system. >> The function I wrote to call volumesegment and prepare_singleshell for each >> subject and save the results is pasted below, with a couple of comments >> added for clarity. >> Over the weekend I tried specifying the coordinate system in the call to >> ft_volumenormalise as 'ctf' rather than 'spm', and commented out all the >> lines that said cfg.spmversion = 'spm8'; before calling a function. However, >> that created worse results, as each plot involved stripes of activation and >> empty voxels, suggesting that 'ctf' was not the correct coordinate system to >> specify. >> >> Thanks for the attached script. Looking in that the comments in that, I >> suspect that the solution to my problems will be to specify my filetype as >> nifti_img rather than nifti. I'll let you know how that goes. >> >> Jen >> >> >> ------------------------------------------------------------------------------------------------------------ >> % the variable subj is simply a string consisting of a subject number >> (e.g. 's05') which can be a folder name or part of a filename >> function [vol mri segmentedmri >> segmentedmriF]=call_volume_segment_function_spm8(subj) >> cfg.spmversion = 'spm8'; >> cfg.template = '/home/woodwardlab/spm8/templates/EPI.nii'; >> %cfg.template='/home/common/matlab/spm2/templates/T1.mnc'; >> cfg.name=[subj '_volseg']; >> cfg.write='yes'; >> cfg.smooth='no'; >> cfg.coordinates='ctf'; >> mri=read_mri([subj '/mri/' subj 'head.mri']); % made with CTF mriConverter >> and mriViewer software, after fiducials were marked >> segmentedmri = volumesegment(cfg, mri); >> segmentedmriF = segmentedmri; >> segmentedmriF.gray = flipdim(flipdim(flipdim(segmentedmriF.gray,3),2),1); >> segmentedmriF.white = >> flipdim(flipdim(flipdim(segmentedmriF.white,3),2),1); >> segmentedmriF.csf = flipdim(flipdim(flipdim(segmentedmriF.csf,3),2),1); >> segmentedmriF.transform = mri.transform; >> segmentedmriF.anatomy = mri.anatomy; >> cfg = []; >> cfg.spmversion = 'spm8'; >> vol = prepare_singleshell(cfg, segmentedmriF); >> eval(['save ' subj '/meg/mrisegmented.mat mri segmentedmri segmentedmriF >> vol']) >> >> >> >> >> >> On Sat, Feb 26, 2011 at 5:26 AM, jan-mathijs schoffelen < >> jan.schoffelen at donders.ru.nl> wrote: >> >> Dear Jen, >> >> >> >> I do not manage to reproduce your issue, when only focussing on the >> ft_volumewrite and visualization part of your pipeline. See attached script, >> and yet an updated version of ft_volumewrite which you need to (hopefully) >> draw the same conclusion as I did. >> >> Yet, I only now realize that your question may pertain to the entire >> pipeline. It could be that something is going wrong there. >> >> I only see now that in the part of your script of which you reported that >> it gave 'good' results, you specify cfg.coordinates = 'ctf' before calling >> ft_volumenormalise. I assume this is correct, because the coordinate system >> your source-reconstructed data lives in, is according to the CTF-convention, >> and not according to the SPM-convention. On the other hand, the template for >> the spatial normalization lives in the SPM-coordinate system. In order for >> the spatial normalization to work OK, Fieldtrip tries to convert from one >> coordinate system to the other (once again, this is appropriate behaviour), >> before doing the actual normalization. It seems that at least in the script >> you sent along, in the final (not working version), you specified >> cfg.coordinates = 'spm' prior to calling ft_volumenormalise. This is >> probably wrong. >> >> Another important point that should be mentioned, is that the coordinate >> systems in which the functional data and the anatomical data live should be >> the same for the ft_sourceinterpolate to make sense. In other words, if your >> source reconstructed images are defined on a 3D grid of positions in >> CTF-space, the mri.transform of your anatomy should describe a >> transformation from voxel to CTF-space. >> >> I think you may want to revisit step by step this part of the pipeline; I >> don't think the problem lies in the writing. >> >> A final possibility of course is that Mricron is misbehaving... >> >> >> >> Best, >> >> >> >> Jan-Mathijs >> >> >> >> >> >> >> >> >> >> >> >> >> >> On Feb 25, 2011, at 9:44 PM, Jen Whitman wrote: >> >> >> >> >> >> >> Hi Jan, >> >> I tried re-running the analysis with the new script you sent me, and the >> latest version of fieldtrip (since I needed ft_get_opt as well), but the >> spm8 images being written are still producing flawed results. It's the same >> problem as I mentioned briefly in my previous post. I am not getting any >> error messages when writing these images. Rather, my problem is that the >> spm8 and spm2 results from the same data ought to be identical when viewed >> in mricron, but they're far from it. When I use mricron to look at the >> results from the spm8-format images, combined across participants to create >> a t-image, I just get a single 'blob' spanning roughly half the brain. In >> contrast, when I used spm2-format previously on the same data, the t-image >> was much more meaningful; a posterior alpha power decrease in a set of >> regions corresponding to the 'task-positive network' (a network found in the >> results of an fMRI version of my experiment, and widely reported in the fMRI >> literature). >> >> This failure to replicate the spm2 results when using spm8 images from the >> same data leads me to suspect that something is wrong with the coordinates >> for spm8 format. However, after experimenting extensively with different cfg >> options I still haven't identified the problem. If I my structural MRIs have >> been saved to .mri files using CTF's MRIConverter program, which cfg >> options, particularly for coordinates, template images, and filetypes, >> should I specify before calling the ft_volumesegment, >> ft_prepare_singleshell, ft_sourceinterpolate, ft_volumenormalise, and >> ft_volumewrite functions? Or should I be calling a different set of >> functions now? >> >> Thanks again for your help, >> >> Jen >> >> On Thu, Feb 24, 2011 at 10:07 AM, Jen Whitman >> wrote: >> >> Great, thanks! >> >> I'll start the analysis with your new script today and will let you know >> how it works out. >> >> Jen >> >> On Thu, Feb 24, 2011 at 4:44 AM, jan-mathijs schoffelen < >> jan.schoffelen at donders.ru.nl> wrote: >> >> Dear Jen, >> >> >> >> I managed to reproduce your problem. The code was rather buggy and indeed >> ft_volumewrite did not behave as it should have. I now fixed it in the code >> and it should run fine now. Please find the updated file attached. It will >> be available on our ftp-server as of tonight. Please note that I updated the >> documentation, and changed the names of some of the options a bit. If you >> want to save your data in analyze-format, you should specify cfg.filetype = >> 'analyze_spm'. If you specify cfg.filetype = 'nifti', it should write out a >> volume to nifti-format, using SPM8. >> >> >> >> Best wishes, >> >> >> >> Jan-Mathijs >> >> >> >> >> >> >> >> >> >> >> >> On Feb 23, 2011, at 7:44 PM, Jen Whitman wrote: >> >> >> >> >> Dear Jan, >> >> Thanks for the quick reply. Yes, I have tried it out quite a few times >> now, experimenting with different settings in the cfgs. Below I'll paste the >> code I've been using to write images - first the code that successfully >> created spm2 images that produced good results, then the code used for >> creating nifti format images from the same data. The comments in this second >> part are at this point a bit of a maze of cfg options I've been changing >> back & forth. Any insights/suggestions regarding how to set up my cfgs to >> make this work would be greatly appreciated. >> >> Jen >> >> >> %%%%%%%% this code generated spm2-compatible images which did work >> (producing results that made sense). >> >> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% >> >> sourcetemp.avg.pow = (sourcetemp.avg.pow - sourcePre.avg.pow) ./ >> sourcePre.avg.pow; >> >> cfg = []; >> cfg.downsample = 2; >> sourcetempInt = sourceinterpolate(cfg, sourcetemp , mri); >> >> % projecting the plot onto a surface... >> cfg = []; >> cfg.coordinates = 'ctf'; >> cfg.template = '/home/common/matlab/spm2/templates/T1.mnc'; %this >> template is in MNI coordinates >> sourcetempIntN = volumenormalise(cfg, sourcetempInt); >> >> filename=[subj 'run' int2str(r) 'cond' int2str(cond) '_' int2str(f) >> 'HzWin' int2str(win) 'width750ms']; >> cfg=[]; >> cfg.parameter = 'avg.pow'; % string, describing the functional >> data to be processed, e.g. 'pow', 'coh' or 'nai' >> cfg.filename = [filename '.img']; %'testimageoutput_alphafreq'; % >> filename without the extension >> cfg.filetype = 'spm'; %'analyze', 'spm', 'vmp' or 'vmr' >> cfg.coordinates = 'spm'; %'spm, 'ctf' or empty for interactive >> (default = []) >> cfg.datatype = 'double'; %'float'; %'double'; %'bit1', 'uint8', >> 'int16', 'int32', 'float' or 'double' >> >> volumewrite(cfg, sourcetempIntN) >> >> >> >> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% >> >> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% >> >> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% >> >> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% >> %%%%% this code below hasn't worked yet... >> >> % I added cfg.spmversion = 'spm8'; >> % in the cfgs for the calls to ft_prepare_leadfield and ft_sourceanalysis, >> % and in the call to prepare_singleshell after calling volumesegment >> >> % I've also ensured that spm8 is the only spm version in my path, even in >> % the fieldtrip/external folder, and ensured that spm8 is installed >> properly >> % (files compiled correctly, etc..) >> >> sourcetemp.avg.pow = (sourcetemp.avg.pow - sourcePre.avg.pow) ./ >> sourcePre.avg.pow; >> >> filename=[subj 'run' int2str(r) 'cond' int2str(cond) '_' int2str(f) >> 'Hzspm8_FIXv9_Win' int2str(win) 'width750ms.img']; >> >> cfg = []; >> % cfg.coordinates = 'spm'; % changed for version 5 >> % cfg.spmversion = 'spm8'; % changed for version 5 >> cfg.downsample = 4; >> sourcetempInt = ft_sourceinterpolate(cfg, sourcetemp , mri); >> >> >> % projecting the plot onto a surface... >> cfg = []; >> %cfg.coordinates = 'spm'; % changed for version 5 >> %cfg.coordinates = 'ctf'; % changed for version 5 >> cfg.coordinates = 'spm'; % changed back to spm for version 9 >> cfg.downsample = 4; >> %cfg.spmversion = 'spm8'; % changed for version 6 (because this gets >> specified in volumewrite) >> cfg.template = 'Hmatrix/mask.nii.nii'; % basically equivalent to using >> spm8/templates/EPI.nii, except that mask.nii (produced from fmri data) has >> the desired voxel size >> % cfg.name = [filename]; % changed for version 6 >> %cfg.write= 'yes'; % changed for version 6 (when this was set to 'yes' >> there was no subsequent call to volumewrite) >> cfg.write= 'no'; % changed for version 6 >> sourcetempIntN = ft_volumenormalise(cfg, sourcetempInt); >> >> % this whole cfg and function call added for version 6 >> cfg=[]; >> % cfg.parameter = string, describing the functional data to be >> processed, e.g. 'pow', 'coh' or 'nai' >> % cfg.filename = filename without the extension >> % cfg.filetype = 'analyze', 'spm', 'vmp' or 'vmr' >> % cfg.vmpversion = 1 or 2 (default) version of the vmp-format to use >> % cfg.coordinates = 'spm, 'ctf' or empty for interactive (default = >> []) >> cfg.parameter='pow'; >> cfg.filename=filename; >> cfg.filetype = 'spm'; >> cfg.spmversion = 'SPM8'; % capitalized after first error message from >> vers 6 >> % cfg.dataformat='nifti'; % added after first error message from vers 6 >> % commented out after 2nd error message >> from vers 6 >> %cfg.vmpversion=2; % this is a filetype, like spm, so don't need to >> specify unless cfg.filetyp='vmp' >> cfg.coordinates='spm'; >> ft_volumewrite(cfg,sourcetempIntN); >> >> >> >> >> >> >> >> On Wed, Feb 23, 2011 at 7:50 AM, jan-mathijs schoffelen < >> jan.schoffelen at donders.ru.nl> wrote: >> >> Dear Jen, >> >> I notice that indeed in the documentation section of ft_write_volume there >> is a FIXME behind nifti. Yet, nifti format seems to be supported by >> ft_write_volume (at least in a recent version of fieldtrip). Did you try it >> at all (and ran into problems) or were you held back by the FIXME statement? >> Could you just try it out using a recent fieldtrip function? >> >> Thanks and best wishes >> >> Jan-Mathijs >> >> >> >> >> On Feb 23, 2011, at 2:21 AM, Jen Whitman wrote: >> >> Hello, >> >> While writing beamformed images to spm2 format in a previous version of >> fieldtrip (now lost due to a computer crash), I was able to get nice-looking >> results; networks of brain regions consistent with existing literature. When >> I try to write images from the same dataset and the same analysis to spm8 >> format, my results (t-images computed across subjects) end up being single >> clusters spanning large sections of the brain (e.g. a 'blob' spanning all of >> one hemisphere but not the other). Unfortunately, some aspects of my planned >> data analyses cannot be performed on spm2 images, so I have to find a way of >> writing to successfully to nifti format. >> >> I just noticed that in the comments in the ft_write_volume function, which >> I am calling via ft_volumewrite, it says 'FIXME' next to nifti under the >> list of supported dataformats. Is there by any chance a patch out there for >> writing nifti images? >> >> Thanks! >> >> _______________________________________________ >> fieldtrip mailing list >> fieldtrip at donders.ru.nl >> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip >> >> >> Dr. J.M. (Jan-Mathijs) Schoffelen >> Donders Institute for Brain, Cognition and Behaviour, >> Centre for Cognitive Neuroimaging, >> Radboud University Nijmegen, The Netherlands >> J.Schoffelen at donders.ru.nl >> Telephone: 0031-24-3614793 >> >> _______________________________________________ >> fieldtrip mailing list >> fieldtrip at donders.ru.nl >> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip >> >> >> _______________________________________________ >> fieldtrip mailing list >> fieldtrip at donders.ru.nl >> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip >> >> >> >> Dr. J.M. (Jan-Mathijs) Schoffelen >> >> Donders Institute for Brain, Cognition and Behaviour, >> Centre for Cognitive Neuroimaging, >> Radboud University Nijmegen, The Netherlands >> >> J.Schoffelen at donders.ru.nl >> >> Telephone: 0031-24-3614793 >> >> >> >> >> _______________________________________________ >> fieldtrip mailing list >> fieldtrip at donders.ru.nl >> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip >> >> >> >> >> _______________________________________________ >> fieldtrip mailing list >> fieldtrip at donders.ru.nl >> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip >> >> >> >> Dr. J.M. (Jan-Mathijs) Schoffelen >> >> Donders Institute for Brain, Cognition and Behaviour, >> Centre for Cognitive Neuroimaging, >> Radboud University Nijmegen, The Netherlands >> >> J.Schoffelen at donders.ru.nl >> >> Telephone: 0031-24-3614793 >> >> >> >> >> _______________________________________________ >> fieldtrip mailing list >> fieldtrip at donders.ru.nl >> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip >> >> >> _______________________________________________ >> fieldtrip mailing list >> fieldtrip at donders.ru.nl >> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip >> >> >> >> Dr. J.M. (Jan-Mathijs) Schoffelen >> >> Donders Institute for Brain, Cognition and Behaviour, >> Centre for Cognitive Neuroimaging, >> Radboud University Nijmegen, The Netherlands >> >> J.Schoffelen at donders.ru.nl >> >> Telephone: 0031-24-3614793 >> >> >> >> >> _______________________________________________ >> fieldtrip mailing list >> fieldtrip at donders.ru.nl >> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip >> >> >> >> >> >> _______________________________________________ >> fieldtrip mailing list >> fieldtrip at donders.ru.nl >> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip >> >> >> >> Dr. J.M. (Jan-Mathijs) Schoffelen >> >> Donders Institute for Brain, Cognition and Behaviour, >> Centre for Cognitive Neuroimaging, >> Radboud University Nijmegen, The Netherlands >> >> J.Schoffelen at donders.ru.nl >> >> Telephone: 0031-24-3614793 >> >> >> >> >> >> _______________________________________________ >> fieldtrip mailing list >> fieldtrip at donders.ru.nl >> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip >> >> >> >> Dr. J.M. (Jan-Mathijs) Schoffelen >> >> Donders Institute for Brain, Cognition and Behaviour, >> Centre for Cognitive Neuroimaging, >> Radboud University Nijmegen, The Netherlands >> >> J.Schoffelen at donders.ru.nl >> >> Telephone: 0031-24-3614793 >> >> >> >> >> >> _______________________________________________ >> fieldtrip mailing list >> fieldtrip at donders.ru.nl >> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip >> >> >> >> Dr. J.M. (Jan-Mathijs) Schoffelen >> >> Donders Institute for Brain, Cognition and Behaviour, >> Centre for Cognitive Neuroimaging, >> Radboud University Nijmegen, The Netherlands >> >> J.Schoffelen at donders.ru.nl >> >> Telephone: 0031-24-3614793 >> >> >> >> _______________________________________________ >> fieldtrip mailing list >> fieldtrip at donders.ru.nl >> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip >> > > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: pic2.jpg Type: image/jpeg Size: 19281 bytes Desc: not available URL: From Jan.Hirschmann at med.uni-duesseldorf.de Fri Apr 15 13:29:46 2011 From: Jan.Hirschmann at med.uni-duesseldorf.de (Jan.Hirschmann at med.uni-duesseldorf.de) Date: Fri, 15 Apr 2011 13:29:46 +0200 Subject: [FieldTrip] I think you solved the problem In-Reply-To: References: <72E993C35FB11743B79FF9286E5B6D8B02676142@Mail2-UKD.VMED.UKD><7B5CA863-D143-404C-BCB9-805AA6E6E546@donders.ru.nl><72E993C35FB11743B79FF9286E5B6D8B02676264@Mail2-UKD.VMED.UKD><72E993C35FB11743B79FF9286E5B6D8B026763B8@Mail2-UKD.VMED.UKD><5AC469DB-D5B1-4E3C-AE21-01A53AE94A26@donders.ru.nl><72E993C35FB11743B79FF9286E5B6D8B02676493@Mail2-UKD.VMED.UKD> Message-ID: <72E993C35FB11743B79FF9286E5B6D8B026766A9@Mail2-UKD.VMED.UKD> Hi Hanneke, it occured to me to change x and y when I clicked around in the mri presented to me by vt_voulmesegment (it shows up when cfg.coordsys is not specified). I noticed that a voxel that had index [i j k] in the neuromag GUI had index [j i k] in this image. But when you specify the fiducials manually in fieldtrip, I don't think you have to worry about that. You could try not to swap x and y coordinates and comment out cfg.coordsys in the segmentation part. In the picture that comes up, do the axes go through the fiducials (y through nas)? If so, the alignment is correct. To my mind, the big helmet in your picture could mean that the sensor positions are given in cm and the headmodel vertices in m. What happens if you multiply headmodel.pos by 10? Best, jan ________________________________ Von: fieldtrip-bounces at donders.ru.nl [mailto:fieldtrip-bounces at donders.ru.nl] Im Auftrag von Hanneke van Dijk Gesendet: Freitag, 15. April 2011 11:34 An: Email discussion list for the FieldTrip project Betreff: Re: [FieldTrip] I think you solved the problem Dear Jan and Jan-Mathijs, Thanks for working on this problem! I'm testing it for data recorded with the 'old' neuromag 122 system. I'm using the script that Jan attached to a previous e-mail, and the fieldtrip version that was released yesterday. The first question that I have is: What to do if you don't have fiducial information from the neuromag software? I could use ft_volume_realign with cfg.method = 'interactive' and point the fiducials out and swap the y and x axes. But in what coordinate system am I then, and in what coordinate system should I move on? second, My 'vol' , headmodel, seems to end up in a factor 10 (or more(?)) smaller unit then the grid and grad. You can't even see it in the headmodelplot (it is a small dot somewhere in the middle). I don't know what happened there. third, If you look at the picture I attached the grid is not in the centre of the helmet (pic1 from the top down), and very low (pic2 looking from the left). I don't know how to solve that. I at least think the subject was not in the helmet that way! Groetjes Hanneke -------------------------------------------------- Dr. Hanneke van Dijk Institut für Klinische Neurowissenschaften und Medizinische Psychologie Gebäude-Nr.: 23.02 Ebene: 03 Zimmer-Nr.: 47 Tel.: +49 211-81-13074 Mail : hanneke.vandijk at med.uni-duesseldorf.de http://www.uniklinik-duesseldorf.de/deutsch/unternehmen/institute/KlinNeurowiss/Team/HannekevanDijk/page.html On Thu, Apr 14, 2011 at 9:31 AM, wrote: Dear Jan-Mathijs, sure, I will do that. I have tested one head model with ft_dipole_simulation and beamforming and it looks good (at least when I simulate two conditions and subtract sources the right location comes out). So I guess we (and maybe others) will use the new procedure now. Best, jan ________________________________ Von: fieldtrip-bounces at donders.ru.nl [mailto:fieldtrip-bounces at donders.ru.nl] Im Auftrag von jan-mathijs schoffelen Gesendet: Mittwoch, 13. April 2011 16:57 An: Email discussion list for the FieldTrip project Betreff: Re: [FieldTrip] I think you solved the problem Dear Jan, No problem. Thanks for the script. If you feel up to it, you are kindly invited to update the documentation on the fieldtrip wiki as well. If I recall correctly, at some point Hanneke added some documentation about how to create MNI-based dipole grids for neuromag data. A lot of the intermediate steps have now become obsolete and this part of the wiki can be substantially cleaned. Thanks, Jan-Mathijs On Apr 13, 2011, at 2:31 PM, wrote: Dear Jan-Mathijs, I think we solved the problem. Everthing is like you said in the first place. ft_volumerealign and ft_volumesegment should be called with cfg.coordsys='neuromag'. The only thing that was wrong is that for the voxel coordinates read from the Neuromag GUI x and y should be swapped. For anyone interested I attach a script that is meant to be easy-to-use for beginners. Thank you very much for your time! ________________________________ Von: fieldtrip-bounces at donders.ru.nl [mailto:fieldtrip-bounces at donders.ru.nl] Im Auftrag von jan-mathijs schoffelen Gesendet: Dienstag, 12. April 2011 21:18 An: Email discussion list for the FieldTrip project Betreff: Re: [FieldTrip] I think you solved the problem Dear Jan, I suspect that your mri, as it comes out of ft_read_mri is already coregistered in neuromag space. After your realignment and after replacing mri.transform with real_mri.transform, the coordinate axes in your pic1 look strange. This I think causes the 'dropped pocket change'. What happens if you skip the ft_volumerealign step and call ft_volumesegment directly on the mri (with cfg.coordsys = 'neuromag', or, for what it's worth, without cfg.coordsys; in this case you will be able to verify the coordinate system)? Alternatively, if this doesn't work, could you replace mri.transform by eye(4) prior to calling ft_volumerealign and ft_volumesegment (both with cfg.coordsys = 'neuromag' and no further tampering with transformation matrices?). Thanks JM On Apr 12, 2011, at 8:49 PM, wrote: Dear Jan-Mathijs, sorry, I think I was a bit too enthusiastic when I said everything worked out wonderfully. It worked only once. After an afternoon of confusion I concluded that on my first try I must have misspelled cfg.coordsys='neuromag' on my calls to ft_volumerealign and ft_volumesegment. In fact, the segmentation looks really bad with these settings. What works for me is written underneath: mri = ft_read_mri('....fif'); hdr=ft_read_header('...fif'); mri.anatomy=double(mri.anatomy); %this is taken from the Neuromag GUI for MRI-MEG Integration cfg=[]; cfg.fiducial.rpa=[136.35 142.80 31.96]; cfg.fiducial.nas=[47.84 101.80 100.10]; cfg.fiducial.lpa=[139.22 146.17 162.69]; %go from neuromag voxel to neuromag head coordinates cfg.coordsys='neuromag'; cfg.method='fiducial'; real_mri=ft_volumerealign(cfg,mri); %taking real_mri with its coordsys field will not work, so I take mri mri.transform=real_mri.transform; cfg = []; cfg.keepintermediate = 'no'; cfg.write = 'no'; segmentedmri = ft_volumesegment(cfg, mri); Before segmentation the function shows some kind of brain (pic 1). When segmentation is done the segmented brain looks good (pic 2) but the brain does not fit the helmet (pic 3). It is looking at its feet as if it dropped some pocket change. Do you know what is going on? Thanks, jan ________________________________ Von: fieldtrip-bounces at donders.ru.nl [mailto:fieldtrip-bounces at donders.ru.nl] Im Auftrag von jan-mathijs schoffelen Gesendet: Dienstag, 12. April 2011 12:11 An: Email discussion list for the FieldTrip project Betreff: Re: [FieldTrip] I think you solved the problem Dear Jan, Apart from not being properly aligned, the segmentation looks a bit strange to me. I suspect that not everything went well here ;o). Could you try the following: specify cfg.coordsys = 'neuromag', both in your call to ft_volumerealign and in your call to ft_volumesegment. The cfg.coordinates for ft_volumesegment has to be removed (actually it is a deprecated option). The idea now is that mri-structures in fieldtrip can have a coordsys field, which allows for more transparent use of the different head coordinate system conventions. This takes away the need for intermediately coregistering the MRI in 'ctf'-convention, and would also take away your need to call headcoordinates later on. Best wishes, Jan-Mathijs On Apr 12, 2011, at 11:07 AM, wrote: Dear fieldtrip experts, I have two questions regarding head model creation. As noted on this thread, the volumesegment function was updated and I tested it for our Neuromag data. The segmentation is performed, but unfortunately it is not aligned with the MRI in my case. Here is the code I am using, the fieldtrip is from 9th April 2011. %read mri mri = ft_read_mri(subject_files.fiff_mri); mri.anatomy=double(mri.anatomy); %these are the fiducials for this subject taken from the Neuromag GUI for coregistration cfg=[]; cfg.fiducial.rpa=[136.35 142.80 31.96]; cfg.fiducial.nas=[47.84 101.80 100.10]; cfg.fiducial.lpa=[139.22 146.17 162.69]; %define the head coordinate system according to CTF conventions cfg.method='fiducial'; real_mri=ft_volumerealign(cfg,mri); %segment cfg = []; cfg.template = '/data/apps/spm/spm8/templates/T1.nii'; cfg.coordinates = 'ctf'; cfg.keepintermediate = 'no'; segmentedmri = ft_volumesegment(cfg, real_mri); %plot white matter test=segmentedmri; test.anatomy=real_mri.anatomy; cfg=[]; cfg.funparameter='white'; ft_sourceplot(cfg,test); %see attached picture The other issue regards back-transformation from CTF to Neuromag coordinates, which is necessary to make the head model fit the sensors. My idea was to create an appropriate transformation matrix like this. cd /net/avidya/storage/home/jan/fieldtrip-20110409/private ctfmat=headcoordinates(nas,lpa,rpa,'ctf'); nmmat=headcoordinates(nas,lpa,rpa,'neuromag'); ctf_to_nm=nmmat/ctfmat; And then to use it on the head model to bring it back into Neuromag coordinates: %create single shell, realistic headmodel cfg = []; hdm = ft_prepare_singleshell(cfg,segmentedmri); % transformation of headmodel into Neuromag space hdm.bnd.pnt=warp_apply(ctf_to_nm,hdm.bnd.pnt,'homogeneous'); Does this survive a sanity check? Best regards and thanks a lot, Jan ________________________________ Von: fieldtrip-bounces at donders.ru.nl [mailto:fieldtrip-bounces at donders.ru.nl] Im Auftrag von Jen Whitman Gesendet: Montag, 28. Februar 2011 22:32 An: Email discussion list for the FieldTrip project Betreff: [FieldTrip] I think you solved the problem I just checked, and when I re-ran my segmentation script with the new Fieldtrip in order to use an spm8 template image, coordinates got reversed. When I take out the calls to flipdim, they look fine (see attached screenshots). That certainly explains the meaningless results I was getting! Thanks for figuring that out, Jen On Mon, Feb 28, 2011 at 12:36 PM, jan-mathijs schoffelen wrote: Hi Jen, At first glance I have a comment on your script. You may need to explicitly check the alignment of your segmented volume and the original anatomy. A while a go some changes were made to ft_volumesegment, taking away the need to do the flipdim(flipdim... operations. I have posted this on the discussion list last January, but you may not have noticed. Anyway, if you now have used a recent version of FieldTrip for your segmentation both the location of your dipole grid, and the volume conductor model will not be adequately coregistered with the data, which may lead to funky results to begin with. That's most likely not related to the filetype in which the volumes are saved for later use. Best wishes, Jan-Mathijs On Feb 28, 2011, at 8:59 PM, Jen Whitman wrote: Hello Jan, When calling volumesegment, I specified 'ctf' as the coordinate system. The function I wrote to call volumesegment and prepare_singleshell for each subject and save the results is pasted below, with a couple of comments added for clarity. Over the weekend I tried specifying the coordinate system in the call to ft_volumenormalise as 'ctf' rather than 'spm', and commented out all the lines that said cfg.spmversion = 'spm8'; before calling a function. However, that created worse results, as each plot involved stripes of activation and empty voxels, suggesting that 'ctf' was not the correct coordinate system to specify. Thanks for the attached script. Looking in that the comments in that, I suspect that the solution to my problems will be to specify my filetype as nifti_img rather than nifti. I'll let you know how that goes. Jen ------------------------------------------------------------------------------------------------------------ % the variable subj is simply a string consisting of a subject number (e.g. 's05') which can be a folder name or part of a filename function [vol mri segmentedmri segmentedmriF]=call_volume_segment_function_spm8(subj) cfg.spmversion = 'spm8'; cfg.template = '/home/woodwardlab/spm8/templates/EPI.nii'; %cfg.template='/home/common/matlab/spm2/templates/T1.mnc'; cfg.name=[subj '_volseg']; cfg.write='yes'; cfg.smooth='no'; cfg.coordinates='ctf'; mri=read_mri([subj '/mri/' subj 'head.mri']); % made with CTF mriConverter and mriViewer software, after fiducials were marked segmentedmri = volumesegment(cfg, mri); segmentedmriF = segmentedmri; segmentedmriF.gray = flipdim(flipdim(flipdim(segmentedmriF.gray,3),2),1); segmentedmriF.white = flipdim(flipdim(flipdim(segmentedmriF.white,3),2),1); segmentedmriF.csf = flipdim(flipdim(flipdim(segmentedmriF.csf,3),2),1); segmentedmriF.transform = mri.transform; segmentedmriF.anatomy = mri.anatomy; cfg = []; cfg.spmversion = 'spm8'; vol = prepare_singleshell(cfg, segmentedmriF); eval(['save ' subj '/meg/mrisegmented.mat mri segmentedmri segmentedmriF vol']) On Sat, Feb 26, 2011 at 5:26 AM, jan-mathijs schoffelen wrote: Dear Jen, I do not manage to reproduce your issue, when only focussing on the ft_volumewrite and visualization part of your pipeline. See attached script, and yet an updated version of ft_volumewrite which you need to (hopefully) draw the same conclusion as I did. Yet, I only now realize that your question may pertain to the entire pipeline. It could be that something is going wrong there. I only see now that in the part of your script of which you reported that it gave 'good' results, you specify cfg.coordinates = 'ctf' before calling ft_volumenormalise. I assume this is correct, because the coordinate system your source-reconstructed data lives in, is according to the CTF-convention, and not according to the SPM-convention. On the other hand, the template for the spatial normalization lives in the SPM-coordinate system. In order for the spatial normalization to work OK, Fieldtrip tries to convert from one coordinate system to the other (once again, this is appropriate behaviour), before doing the actual normalization. It seems that at least in the script you sent along, in the final (not working version), you specified cfg.coordinates = 'spm' prior to calling ft_volumenormalise. This is probably wrong. Another important point that should be mentioned, is that the coordinate systems in which the functional data and the anatomical data live should be the same for the ft_sourceinterpolate to make sense. In other words, if your source reconstructed images are defined on a 3D grid of positions in CTF-space, the mri.transform of your anatomy should describe a transformation from voxel to CTF-space. I think you may want to revisit step by step this part of the pipeline; I don't think the problem lies in the writing. A final possibility of course is that Mricron is misbehaving... Best, Jan-Mathijs On Feb 25, 2011, at 9:44 PM, Jen Whitman wrote: Hi Jan, I tried re-running the analysis with the new script you sent me, and the latest version of fieldtrip (since I needed ft_get_opt as well), but the spm8 images being written are still producing flawed results. It's the same problem as I mentioned briefly in my previous post. I am not getting any error messages when writing these images. Rather, my problem is that the spm8 and spm2 results from the same data ought to be identical when viewed in mricron, but they're far from it. When I use mricron to look at the results from the spm8-format images, combined across participants to create a t-image, I just get a single 'blob' spanning roughly half the brain. In contrast, when I used spm2-format previously on the same data, the t-image was much more meaningful; a posterior alpha power decrease in a set of regions corresponding to the 'task-positive network' (a network found in the results of an fMRI version of my experiment, and widely reported in the fMRI literature). This failure to replicate the spm2 results when using spm8 images from the same data leads me to suspect that something is wrong with the coordinates for spm8 format. However, after experimenting extensively with different cfg options I still haven't identified the problem. If I my structural MRIs have been saved to .mri files using CTF's MRIConverter program, which cfg options, particularly for coordinates, template images, and filetypes, should I specify before calling the ft_volumesegment, ft_prepare_singleshell, ft_sourceinterpolate, ft_volumenormalise, and ft_volumewrite functions? Or should I be calling a different set of functions now? Thanks again for your help, Jen On Thu, Feb 24, 2011 at 10:07 AM, Jen Whitman wrote: Great, thanks! I'll start the analysis with your new script today and will let you know how it works out. Jen On Thu, Feb 24, 2011 at 4:44 AM, jan-mathijs schoffelen wrote: Dear Jen, I managed to reproduce your problem. The code was rather buggy and indeed ft_volumewrite did not behave as it should have. I now fixed it in the code and it should run fine now. Please find the updated file attached. It will be available on our ftp-server as of tonight. Please note that I updated the documentation, and changed the names of some of the options a bit. If you want to save your data in analyze-format, you should specify cfg.filetype = 'analyze_spm'. If you specify cfg.filetype = 'nifti', it should write out a volume to nifti-format, using SPM8. Best wishes, Jan-Mathijs On Feb 23, 2011, at 7:44 PM, Jen Whitman wrote: Dear Jan, Thanks for the quick reply. Yes, I have tried it out quite a few times now, experimenting with different settings in the cfgs. Below I'll paste the code I've been using to write images - first the code that successfully created spm2 images that produced good results, then the code used for creating nifti format images from the same data. The comments in this second part are at this point a bit of a maze of cfg options I've been changing back & forth. Any insights/suggestions regarding how to set up my cfgs to make this work would be greatly appreciated. Jen %%%%%%%% this code generated spm2-compatible images which did work (producing results that made sense). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% sourcetemp.avg.pow = (sourcetemp.avg.pow - sourcePre.avg.pow) ./ sourcePre.avg.pow; cfg = []; cfg.downsample = 2; sourcetempInt = sourceinterpolate(cfg, sourcetemp , mri); % projecting the plot onto a surface... cfg = []; cfg.coordinates = 'ctf'; cfg.template = '/home/common/matlab/spm2/templates/T1.mnc'; %this template is in MNI coordinates sourcetempIntN = volumenormalise(cfg, sourcetempInt); filename=[subj 'run' int2str(r) 'cond' int2str(cond) '_' int2str(f) 'HzWin' int2str(win) 'width750ms']; cfg=[]; cfg.parameter = 'avg.pow'; % string, describing the functional data to be processed, e.g. 'pow', 'coh' or 'nai' cfg.filename = [filename '.img']; %'testimageoutput_alphafreq'; % filename without the extension cfg.filetype = 'spm'; %'analyze', 'spm', 'vmp' or 'vmr' cfg.coordinates = 'spm'; %'spm, 'ctf' or empty for interactive (default = []) cfg.datatype = 'double'; %'float'; %'double'; %'bit1', 'uint8', 'int16', 'int32', 'float' or 'double' volumewrite(cfg, sourcetempIntN) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%% this code below hasn't worked yet... % I added cfg.spmversion = 'spm8'; % in the cfgs for the calls to ft_prepare_leadfield and ft_sourceanalysis, % and in the call to prepare_singleshell after calling volumesegment % I've also ensured that spm8 is the only spm version in my path, even in % the fieldtrip/external folder, and ensured that spm8 is installed properly % (files compiled correctly, etc..) sourcetemp.avg.pow = (sourcetemp.avg.pow - sourcePre.avg.pow) ./ sourcePre.avg.pow; filename=[subj 'run' int2str(r) 'cond' int2str(cond) '_' int2str(f) 'Hzspm8_FIXv9_Win' int2str(win) 'width750ms.img']; cfg = []; % cfg.coordinates = 'spm'; % changed for version 5 % cfg.spmversion = 'spm8'; % changed for version 5 cfg.downsample = 4; sourcetempInt = ft_sourceinterpolate(cfg, sourcetemp , mri); % projecting the plot onto a surface... cfg = []; %cfg.coordinates = 'spm'; % changed for version 5 %cfg.coordinates = 'ctf'; % changed for version 5 cfg.coordinates = 'spm'; % changed back to spm for version 9 cfg.downsample = 4; %cfg.spmversion = 'spm8'; % changed for version 6 (because this gets specified in volumewrite) cfg.template = 'Hmatrix/mask.nii.nii'; % basically equivalent to using spm8/templates/EPI.nii, except that mask.nii (produced from fmri data) has the desired voxel size % cfg.name = [filename]; % changed for version 6 %cfg.write= 'yes'; % changed for version 6 (when this was set to 'yes' there was no subsequent call to volumewrite) cfg.write= 'no'; % changed for version 6 sourcetempIntN = ft_volumenormalise(cfg, sourcetempInt); % this whole cfg and function call added for version 6 cfg=[]; % cfg.parameter = string, describing the functional data to be processed, e.g. 'pow', 'coh' or 'nai' % cfg.filename = filename without the extension % cfg.filetype = 'analyze', 'spm', 'vmp' or 'vmr' % cfg.vmpversion = 1 or 2 (default) version of the vmp-format to use % cfg.coordinates = 'spm, 'ctf' or empty for interactive (default = []) cfg.parameter='pow'; cfg.filename=filename; cfg.filetype = 'spm'; cfg.spmversion = 'SPM8'; % capitalized after first error message from vers 6 % cfg.dataformat='nifti'; % added after first error message from vers 6 % commented out after 2nd error message from vers 6 %cfg.vmpversion=2; % this is a filetype, like spm, so don't need to specify unless cfg.filetyp='vmp' cfg.coordinates='spm'; ft_volumewrite(cfg,sourcetempIntN); On Wed, Feb 23, 2011 at 7:50 AM, jan-mathijs schoffelen wrote: Dear Jen, I notice that indeed in the documentation section of ft_write_volume there is a FIXME behind nifti. Yet, nifti format seems to be supported by ft_write_volume (at least in a recent version of fieldtrip). Did you try it at all (and ran into problems) or were you held back by the FIXME statement? Could you just try it out using a recent fieldtrip function? Thanks and best wishes Jan-Mathijs On Feb 23, 2011, at 2:21 AM, Jen Whitman wrote: Hello, While writing beamformed images to spm2 format in a previous version of fieldtrip (now lost due to a computer crash), I was able to get nice-looking results; networks of brain regions consistent with existing literature. When I try to write images from the same dataset and the same analysis to spm8 format, my results (t-images computed across subjects) end up being single clusters spanning large sections of the brain (e.g. a 'blob' spanning all of one hemisphere but not the other). Unfortunately, some aspects of my planned data analyses cannot be performed on spm2 images, so I have to find a way of writing to successfully to nifti format. I just noticed that in the comments in the ft_write_volume function, which I am calling via ft_volumewrite, it says 'FIXME' next to nifti under the list of supported dataformats. Is there by any chance a patch out there for writing nifti images? Thanks! _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 _______________________________________________ fieldtrip mailing list fieldtrip at donders.ru.nl http://mailman.science.ru.nl/mailman/listinfo/fieldtrip -------------- next part -------------- An HTML attachment was scrubbed... URL: From bick35 at gmail.com Fri Apr 15 20:12:02 2011 From: bick35 at gmail.com (Steph Bickel) Date: Fri, 15 Apr 2011 14:12:02 -0400 Subject: [FieldTrip] Postdoc position available in New York Message-ID: Post doctoral research position available for research using a multimodal imaging approach at the Hofstra University School of Medicine in partnership with the North Shore LIJ Health System, NY, USA. Studies involve surgical epilepsy patients undergoing intracranial electrophysiological monitoring for seizure detection and functional electrical stimulation mapping. Ongoing research projects include: 1) validation of task-based and resting state fMRI and DTI using electrical stimulation mapping and ECog; 2) investigation of the neuronal dynamics underlying selective attention and active sensing, language, object identification and auditory stream analysis; and 3) prediction of seizure spread using electrophysiological and MRI markers. Responsibilities will include designing and overseeing fMRI and ECoG experiments, data analysis and the coordination of access to patients for research studies. Candidates should have M.D. and/or Ph.D. degrees and have some background in fMRI, electrophysiology, and/or data analysis (Matlab). Please submit CV and short statement of interest to Dr. Ashesh Mehta at *amehta at nshs.edu* for more information. -------------- next part -------------- An HTML attachment was scrubbed... URL: From bick35 at gmail.com Sat Apr 16 00:04:38 2011 From: bick35 at gmail.com (Steph Bickel) Date: Fri, 15 Apr 2011 18:04:38 -0400 Subject: [FieldTrip] Postdoc position available in New York for intracranial EEG and fMRI Message-ID: Post doctoral research position available for research using a multimodal imaging approach at the Hofstra University School of Medicine in partnership with the North Shore LIJ Health System, NY, USA. Studies involve surgical epilepsy patients undergoing intracranial electrophysiological monitoring for seizure detection and functional electrical stimulation mapping. Ongoing research projects include: 1) validation of task-based and resting state fMRI and DTI using electrical stimulation mapping and ECog; 2) investigation of the neuronal dynamics underlying selective attention and active sensing, language, object identification and auditory stream analysis; and 3) prediction of seizure spread using electrophysiological and MRI markers. Responsibilities will include designing and overseeing fMRI and ECoG experiments, data analysis and the coordination of access to patients for research studies. Candidates should have M.D. and/or Ph.D. degrees and have some background in fMRI, electrophysiology, and/or data analysis (Matlab). Please submit CV and short statement of interest to Dr. Ashesh Mehta at *amehta at nshs.edu* for more information. -------------- next part -------------- An HTML attachment was scrubbed... URL: From max.taubert at gmail.com Sun Apr 17 13:44:31 2011 From: max.taubert at gmail.com (Max T.) Date: Sun, 17 Apr 2011 13:44:31 +0200 Subject: [FieldTrip] using a four shell model Message-ID: Dear all, I am new to fieldtrip and I currently tried to do a simple dipole fit on simulated data. I tried to analyse EEG data (33 channels) which was forward modeled (outside fieldtrip) using a single dipole and a four shell headmodel with radii of 85mm for the head, 6mm for the scalp, 7mm for the bone and 1mm for the csf. I tried several ideas on how to transfer this head model into fieldtrip. Unfortunately, none of my dipole fits inside fieldtrip suited my forward model. My script looks like this: avg = besa2fieldtrip('data.mul'); avg.elec = ft_read_sens('data_elec.sfp'); vol.o = [0 0 0]; vol.r = [0.84 0.85 0.92 1]; vol.c = [0.3300 1 0.0042 0.3300]; cfg = []; cfg.elec = avg.elec; cfg.vol = vol; cfg.gridsearch = 'no'; cfg.model = 'regional'; dipol = ft_dipolefitting(cfg,avg); I would appreciate any help with this. Max Taubert From bleichner.martin at gmail.com Mon Apr 18 11:39:32 2011 From: bleichner.martin at gmail.com (Martin Bleichner) Date: Mon, 18 Apr 2011 11:39:32 +0200 Subject: [FieldTrip] BCI in 2011 and 8th BCI2000 workshop: Early Registration Deadline April 20th In-Reply-To: References: Message-ID: Dear Colleague, Please note that the early registration-deadline for the two-day symposium 'Brain-Computer Interfacing in 2011' and the 8th BCI2000 workshop is approaching fast. After April 20th, participation is subject to increased registration fees. If you are interested in interfacing with the human brain, and would like to learn about the future directions of BCI research, register now on www.bci2011.eu. Yours Sincerely, The Organizing Committee ------------------------------ *‘Brain-Computer Interfacing in 20**1**1**’* What is this? A two-day symposium on Brain-Computer Interfacing When and Where? Utrecht, Netherlands, May 20&21, 2011 By Whom? UMC Utrecht/Rudolf Magnus Institute and the BrainGain Consortium For Whom? Anyone interested in: Human Brain Function Interfacing with the human brain and mind Developing solutions for paralyzed patients Who speaks? Brendan Allison, Bernhard Graimann, Eberhard Fetz, Beata Jarosiewicz, Jean-Philippe Lachaux, Eric Leuthardt, Phil Kennedy, Christa Neuper, Nick Ramsey, Gerwin Schalk, Bill Shain, Andrew Schwartz, Jonathan Wolpaw For more information, please visit www.bci2011.eu ** *T**he **8th **BCI2000 workshop* What is this? A two-day workshop on Brain-Computer Interfacing and BCI2000 When and Where? Utrecht, Netherlands, May 18&19, 2011 By Whom? UMC Utrecht/Rudolf Magnus Institute and BCI2000 For Whom? Anyone interested in: Human Brain Function Interfacing with the human brain and mind Developing solutions for paralyzed patients Program: Lectures that describe relevant technical aspects of the BCI2000 system including implementation with C++, Matlab, Fieldtrip or Python. Hands‐on practical tutorials where participants use BCI systems to control a cursor on a computer screen and to spell words just by thinking. Exercises, in which participants build and configure a BCI with their own signal processing methods, applications, or assistive devices. For more information, please visit www.bci2011.eu -------------- next part -------------- An HTML attachment was scrubbed... URL: From a.llera at donders.ru.nl Tue Apr 19 14:39:26 2011 From: a.llera at donders.ru.nl (Alberto Llera) Date: Tue, 19 Apr 2011 14:39:26 +0200 Subject: [FieldTrip] question In-Reply-To: References: Message-ID: Hey Martin I am trying to register for the symposium, and i came across a little problem. Do you know what the enrollment number it is? Thanks in advanced and see you in Utrech (again) Alberto ------------------- > Dear Colleague, > > > > Please note that the early registration-deadline for the two-day symposium > 'Brain-Computer Interfacing in 2011' and the 8th BCI2000 workshop is > approaching fast. After April 20th, participation is subject to increased > registration fees. > > > > If you are interested in interfacing with the human brain, and would like > to > learn about the future directions of BCI research, register now on > www.bci2011.eu. > > > > Yours Sincerely, > > The Organizing Committee > > > ------------------------------ > > > > > > *‘Brain-Computer Interfacing in 20**1**1**’* > > > > What is this? A two-day symposium on Brain-Computer > Interfacing > > > > When and Where? Utrecht, Netherlands, May 20&21, 2011 > > > > By Whom? UMC Utrecht/Rudolf Magnus Institute and the > BrainGain Consortium > > > > For Whom? Anyone interested in: > > Human Brain Function > > Interfacing with the human brain > and > mind > > Developing solutions for paralyzed > patients > > > > Who speaks? Brendan Allison, Bernhard Graimann, Eberhard > Fetz, Beata Jarosiewicz, Jean-Philippe Lachaux, Eric Leuthardt, > > Phil Kennedy, Christa Neuper, Nick > Ramsey, Gerwin Schalk, Bill Shain, Andrew Schwartz, Jonathan Wolpaw > > > > For more information, please visit www.bci2011.eu > > > > > > ** > > *T**he **8th **BCI2000 workshop* > > > What is this? A two-day workshop on Brain-Computer > Interfacing and BCI2000 > > > > When and Where? Utrecht, Netherlands, May 18&19, 2011 > > > > By Whom? UMC Utrecht/Rudolf Magnus Institute and BCI2000 > > > > For Whom? Anyone interested in: > > Human Brain Function > > Interfacing with the human brain and > mind > > Developing solutions for paralyzed > patients > > > > Program: Lectures that describe relevant technical > aspects of the BCI2000 system including implementation with C++, > Matlab, Fieldtrip or Python. > > Hands‐on practical tutorials where > participants use BCI systems to control a cursor on a computer screen and > to > spell words just by thinking. > > Exercises, in which participants > build > and configure a BCI with their own signal processing methods, > applications, > or assistive devices. > > > > For more information, please visit www.bci2011.eu > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip -- Alberto Llera Arenas Ph.D. Student Donders Institute for Brain, Cognition and Behaviour Radboud University Nijmegen Geert Grooteplein 21, route 126 Nijmegen, The Netherlands Tel: +31(0)24 3614230 http://www.mbfys.ru.nl/staff/a.llera/ From H.Rossiter at ion.ucl.ac.uk Wed Apr 20 12:48:08 2011 From: H.Rossiter at ion.ucl.ac.uk (Holly Rossiter) Date: Wed, 20 Apr 2011 11:48:08 +0100 Subject: [FieldTrip] FFT on EMG data Message-ID: <004701cbff48$6fe11020$4fa33060$@Rossiter@ion.ucl.ac.uk> Hi, I am trying to run an FFT on some EMG data to obtain the peak frequency. This is the script I am using... D= spm_eeg_load; emg = D.ftraw(0); cfg=[]; cfg.method='mtmfft'; cfg.output='pow'; cfg.taper='hanning'; cfg.channel={'Lforearm'}; cfg.foi= [5 80];% frequency band - foilim or just foi?? freq=ft_freqanalysis(cfg,emg); figure semilogy(freq.freq, freq.powspctrm(1,:), 'b-'); However, I keep getting this error... processing trial 1, ??? Undefined function or variable "dum". Error in ==> ft_freqanalysis_mtmfft at 345 fprintf('nfft: %d samples, taper length: %d samples, %d tapers\n',length(dum),size(tap,2),numtap); Error in ==> ft_freqanalysis at 111 [freq] = feval(sprintf('ft_freqanalysis_%s',lower(cfg.method)), cfg, data); Do you know how to fix this error? Thanks, Holly -------------- next part -------------- An HTML attachment was scrubbed... URL: From jan.schoffelen at donders.ru.nl Wed Apr 20 13:50:12 2011 From: jan.schoffelen at donders.ru.nl (jan-mathijs schoffelen) Date: Wed, 20 Apr 2011 13:50:12 +0200 Subject: [FieldTrip] FFT on EMG data In-Reply-To: <004701cbff48$6fe11020$4fa33060$@Rossiter@ion.ucl.ac.uk> References: <004701cbff48$6fe11020$4fa33060$@Rossiter@ion.ucl.ac.uk> Message-ID: <06E20A36-FFC2-4D83-AB63-F48FA0D2F0D1@donders.ru.nl> Hi Holly, What version of fieldtrip are you using? Best Jan-M On Apr 20, 2011, at 12:48 PM, Holly Rossiter wrote: > Hi, > > I am trying to run an FFT on some EMG data to obtain the peak > frequency. This is the script I am using... > > D= spm_eeg_load; > emg = D.ftraw(0); > > cfg=[]; > > cfg.method='mtmfft'; > cfg.output='pow'; > cfg.taper='hanning'; > cfg.channel={'Lforearm'}; > cfg.foi= [5 80];% frequency band - foilim or just foi?? > freq=ft_freqanalysis(cfg,emg); > > figure > semilogy(freq.freq, freq.powspctrm(1,:), 'b-'); > > However, I keep getting this error... > > processing trial 1, ??? Undefined function or variable "dum". > > Error in ==> ft_freqanalysis_mtmfft at 345 > fprintf('nfft: %d samples, taper length: %d samples, %d > tapers\n',length(dum),size(tap,2),numtap); > > Error in ==> ft_freqanalysis at 111 > [freq] = > feval(sprintf('ft_freqanalysis_%s',lower(cfg.method)), cfg, > data); > > Do you know how to fix this error? > > Thanks, > > Holly > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 -------------- next part -------------- An HTML attachment was scrubbed... URL: From max.taubert at gmail.com Wed Apr 20 16:08:39 2011 From: max.taubert at gmail.com (Max T.) Date: Wed, 20 Apr 2011 16:08:39 +0200 Subject: [FieldTrip] [Fieldtrip] dipole-fitting problem Message-ID: Dear all, I am new to fieldtrip and I currently tried to do a simple dipole fit on EEG data using a four-shell headmodel. The data consists of 96 trials which I preprocess and average through fieldtrip, then I do the dipole fit using two symmetric dipoles. As I only wanted to try out the fitting-capabilities of fieldtrip, I skipped artifact detection etc. The problem I encountered is that the fitting results from fieldtrip vastly differ from results that come from BESA, the dipoles have totaly different positions. May this be caused by the different algorithms of FT and BESA? Or must there be something wrong with my script? Besides this, does FT have capabilities to plot source-level data using the method 'surface' if there's no individual MRI available? This is what my script looks like: cfg = []; cfg.dataset = 'data.cnt'; cfg.trialdef.eventtype = 'trigger'; cfg.trialdef.eventvalue = 1; cfg.trialdef.prestim = 0.5; cfg.trialdef.poststim = 1; cfg = ft_definetrial(cfg); cfg.channel=1:30; cfg.demean = 'yes'; cfg.baselinewindow = [-0.1 0]; data = ft_preprocessing(cfg); avg = ft_timelockanalysis(cfg,data); vol.o = [0 0 0]; vol.c = [0.3300 1 0.0042 0.3300]; vol.r = [0.84 0.85 0.92 1]; elec = ft_read_sens('electrodes.sfp'); cfg.numdipoles = 2; cfg.symmetry = 'x'; cfg.channel = 1:30; cfg.elec = elec; cfg.vol = vol; cfg.gridsearch = 'yes'; cfg.grid.resolution = 1; cfg.model = 'regional'; cfg.latency = [0.07 0.08]; cfg.channel = 'all'; dipol = ft_dipolefitting(cfg,avg); Thanks in advance Max Taubert From r.vandermeij at donders.ru.nl Wed Apr 20 17:59:51 2011 From: r.vandermeij at donders.ru.nl (Roemer van der Meij) Date: Wed, 20 Apr 2011 11:59:51 -0400 Subject: [FieldTrip] FFT on EMG data In-Reply-To: <004701cbff48$6fe11020$4fa33060$@Rossiter@ion.ucl.ac.uk> References: <004701cbff48$6fe11020$4fa33060$@Rossiter@ion.ucl.ac.uk> Message-ID: <4DAF02F7.9090709@donders.ru.nl> Hi Holly, A few months ago we revised the entire frequency analysis module, if you download the latest version you should be fine. In the old situation, cfg.foi could only be used for method = mtmconvol, and cfg.foilim was the way to go with method = mtmfft. In the new version, you can also request specific frequencies with mtmfft using cfg.foi, next to using cfg.foilim to define a range. Note though, a cfg.foi = [5 80] (/= not cfg.foilim/) will only result in frequency estimates at 5 and 80 Hz, whereas a cfg.foilim = [5 80] would result in all possible frequencies in that range. Best, Roemer On 20-Apr-11 06:48, Holly Rossiter wrote: > > Hi, > > I am trying to run an FFT on some EMG data to obtain the peak > frequency. This is the script I am using... > > D= spm_eeg_load; > > emg = D.ftraw(0); > > cfg=[]; > > cfg.method='mtmfft'; > > cfg.output='pow'; > > cfg.taper='hanning'; > > cfg.channel={'Lforearm'}; > > cfg.foi= [5 80];% frequency band - foilim or just foi?? > > freq=ft_freqanalysis(cfg,emg); > > figure > > semilogy(freq.freq, freq.powspctrm(1,:), 'b-'); > > However, I keep getting this error... > > processing trial 1, ??? Undefined function or variable "dum". > > Error in ==> ft_freqanalysis_mtmfft at 345 > > fprintf('nfft: %d samples, taper length: %d samples, %d > > tapers\n',length(dum),size(tap,2),numtap); > > Error in ==> ft_freqanalysis at 111 > > [freq] = > > feval(sprintf('ft_freqanalysis_%s',lower(cfg.method)), cfg, > > data); > > Do you know how to fix this error? > > Thanks, > > Holly > > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip -- Roemer van der Meij M.Sc. PhD student Donders Institute for Brain, Cognition and Behaviour Centre for Cognition Radboud University Nijmegen P.O. Box 9104 6500 HE Nijmegen The Netherlands Tel: +31(0)24 3655932 E-mail: r.vandermeij at donders.ru.nl -------------- next part -------------- An HTML attachment was scrubbed... URL: From r.vandermeij at donders.ru.nl Wed Apr 20 20:16:25 2011 From: r.vandermeij at donders.ru.nl (Roemer van der Meij) Date: Wed, 20 Apr 2011 14:16:25 -0400 Subject: [FieldTrip] Changed phase convention 'wavelet' ('wltconvol') Message-ID: <4DAF22F9.4080007@donders.ru.nl> Hi everybody, We have changed the meaning of phases of /raw/ Fourier-coefficients of method = 'wavelet' (previously 'wltconvol'), so that it is in alignment with method = 'mtmconvol'. All output is now phase-shifted such that an angle of 0 of any Fourier-coefficient always means a peak of an oscillation in the data, and an angle of pi/-pi will always mean the trough of an oscillation (wavelet wise angle = 0 is implemented as cosine at peak, and sine in up-going flank) (also documented in the FAQ section here ) Processed phases, like those in a cross-spectral density array and it's children like coherence, PLVs etc., will /not /be different. You will only notice the difference if you choose cfg.output = 'fourier'. The change will be latest version on our FTP-server tonight. Best, Roemer -- Roemer van der Meij M.Sc. PhD student Donders Institute for Brain, Cognition and Behaviour Centre for Cognition Radboud University Nijmegen P.O. Box 9104 6500 HE Nijmegen The Netherlands Tel: +31(0)24 3655932 E-mail: r.vandermeij at donders.ru.nl -------------- next part -------------- An HTML attachment was scrubbed... URL: From Heng-RuMay.Tan at glasgow.ac.uk Thu Apr 21 14:27:25 2011 From: Heng-RuMay.Tan at glasgow.ac.uk (May (Heng-Ru May TAN)) Date: Thu, 21 Apr 2011 13:27:25 +0100 Subject: [FieldTrip] Question about SPM brain templates including the cerebellum Message-ID: <4DB022AD.20701@glasgow.ac.uk> Hi I was wondering if there exists within the folders of Fieldtrip, surface source-plot MRI templates which includes the cerebellum, and if not, how could one create a template which consists of the cerebellum, too? Any help would be gratefully appreciated! Thanks. May -------------- next part -------------- An HTML attachment was scrubbed... URL: From manuel.mercier at einstein.yu.edu Thu Apr 21 22:10:45 2011 From: manuel.mercier at einstein.yu.edu (Manuel Mercier) Date: Thu, 21 Apr 2011 16:10:45 -0400 Subject: [FieldTrip] Statistics (against baseline) Message-ID: <4DB08F45.2090803@einstein.yu.edu> Dear Field-trippers First of all, I would like to thank the Fieldtrip mentors, and all the contributors. I find this toolbox more than a toolbox. The website and the active mailing list makes it stimulating and definitively instructive. Which motivates me to share with you some reflections and questions. I did some statistics on data from implanted electrodes (ECoG) in human. For the purpose of this analysis, I mainly looked at the time frequency space, so I first ran the following script: (with data being the output of the /ft_preprocessing/ function) load data; trig = [3 4 5]; for cond = 1:length(trig) cfg = []; cfg.method = 'wavelet'; cfg.output = 'fourier'; cfg.foi = 2:2:50; cfg.toi = -0.5:0.02:0.05; cfg.keeptrials = 'yes'; cfg.keeptaper = 'yes'; cfg.width = 5; cfg.trials = find(data.trialinfo(:,1) == trig(cond)); TF_Mwlt_fourier{cond} = ft_freqanalysis(cfg, data); end; I used Morlet wavelet because a previous post from Robert that recommended not to use multitapering for PLF (http://mailman.science.ru.nl/pipermail/fieldtrip/2006-March/000446.html). And also to facilitate comparison with other studies. The output being Fourier, I computed power and phase concentration (aka PLF or ITC), (both calculated at single trial level for stats and then averaged for /ft_multiplot//TFR/ ) powplf_data.pow = abs(data.fourierspctrm) .^2; powplf_data.powspctrm = abs(mean(squeeze(powplf_data.pow),1)); powplf_data.plf = data.fourierspctrm./abs(data.fourierspctrm); powplf_data.plf_average = abs(mean(squeeze(powplf_data.plf),1)); The first statistics I wanted to run was a comparison of the power and the PLF for each condition against their respective baseline period. To do so I applied the following method (based on Delorme et Makeig 2004) for a given channel: - draw a value within the baseline period for each trial (independently for each time point and frequency). - average along the trial dimension - repeat those steps thousand time - use those thousand repetition to construct the distribution - count the percentage of values above (/below) the observed post-onset value from the data (at a given latency and frequency). Define significance for power using two tails (p < 0.025 & p > 0.975), and one tail for PLF (p<0.05). I decided to write my own function because I was not sure that I could do it using Field trip. I noticed that there is the /statfun_actvsblT/ that can be specified in /cfg.method/ field of /ft_freqstatistics/. But I have two concerns about it: - I prefer to used a randomization method for distribution reason. Indeed even if for power it seems to be ok with my data (seems to be normally distributed), it is by definition not the case with PLF (which is more like a gamma or F distribution; because values are more concentrated near to zero, rare value toward 1). - this function average over the specified baseline time period. This average step makes more sense to me in the case of ERP analysis, but less with time frequency. Especially with PLF, since the average will have the tendency to compress the values toward 0. I guess that an alternative would be to use /statfun_diff_itc/ with one condition being post-onset period and the other "fake" condition being the baseline. But in this case the length (duration) of the two pools should be identical, as the time points would be "paired". Am I correct about this or is it more flexible ? Here are the points I would like to discuss: 1) I think I did my analysis the correct way, but it might not be the case, so any comments about the method are very welcome. 2) when someone is interested in the phase, is there a "better" method to compute the time frequency transform? (or any method is good as long as there is no frequency smoothing) 3) can we imagine a future extra/new option in the /statfun_actvsbl/ that would allow for choosing between averaging and taking a random time point within the specified time period ? Maybe this makes less sense for T-stats than in the case of a randomization test ? and even less when this is not done at the level of single trials ? Thanks in advance for your comments. Manuel -- Manuel Mercier, PhD Research Fellow Cognitive Neurophysiology Laboratory, Children's Evaluation and Rehabilitation Center (CERC), Departments of Pediatrics Albert Einstein College of Medicine, 1225 Morris Park Avenue Bronx , New York, NY 10461 phone: +1 (718) 862 1824 fax: +1 (718) 862 1807 -------------- next part -------------- An HTML attachment was scrubbed... URL: From jan.schoffelen at donders.ru.nl Fri Apr 22 09:30:58 2011 From: jan.schoffelen at donders.ru.nl (jan-mathijs schoffelen) Date: Fri, 22 Apr 2011 09:30:58 +0200 Subject: [FieldTrip] Question about SPM brain templates including the cerebellum In-Reply-To: <4DB022AD.20701@glasgow.ac.uk> References: <4DB022AD.20701@glasgow.ac.uk> Message-ID: <79DC2E75-C97A-4DCB-B387-250F7E0B8F00@donders.ru.nl> Dear May, The surface files contain only a triangulation of the neo-cortical surface. Typically, software packages creating high-resolution meshes of the brain (such as freesurfer) exclude the cerebellum. For the figures in the famous Schoffelen et al 2008 paper (Neuroimage) I created the surfaces (with cerebellum) using a segmented template MRI (using SPM) and then, after some image processing (smoothing filling etc), called the matlab isosurface function. This gives a triangulated surface which can be used for visualization. Note that this procedure does not yield topologically a sphere, so it cannot be used for inflation. Best, Jan-Mathijs On Apr 21, 2011, at 2:27 PM, May (Heng-Ru May TAN) wrote: > Hi > > I was wondering if there exists within the folders of Fieldtrip, > surface source-plot MRI templates which includes the cerebellum, and > if not, how could one create a template which consists of the > cerebellum, too? > > Any help would be gratefully appreciated! > > Thanks. > May > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793 -------------- next part -------------- An HTML attachment was scrubbed... URL: From Heng-RuMay.Tan at glasgow.ac.uk Fri Apr 22 19:39:35 2011 From: Heng-RuMay.Tan at glasgow.ac.uk (Heng-Ru May Tan) Date: Fri, 22 Apr 2011 18:39:35 +0100 Subject: [FieldTrip] Question about SPM brain templates including the cerebellum In-Reply-To: <79DC2E75-C97A-4DCB-B387-250F7E0B8F00@donders.ru.nl> References: <4DB022AD.20701@glasgow.ac.uk> <79DC2E75-C97A-4DCB-B387-250F7E0B8F00@donders.ru.nl> Message-ID: <4DB1BD57.5000803@glasgow.ac.uk> Dear Jan-Mathijs, Thank you for the sharing the information. Before trying to 're-invent the wheel', might it be possible for Fieldtrip to incorporate the famous Schoffelen et al., 2008's cerebellar-included MRI template for visualization purpose -- with the awareness that it will not permit inflation? Unless my limited knowledge on brain graphics has prevented me from appreciating the importance of 'inflation' within the Fieldtrip coding environment; in which case, I hope to be enlightened, if it is within anyone's knowledge. Also, does the 'isosurface' function preserve the MNI coordinates, if I should try to create my own template? Many thanks, again! And Happy Easter to all. May On 22/04/2011 08:30, jan-mathijs schoffelen wrote: > Dear May, > > The surface files contain only a triangulation of the neo-cortical > surface. > Typically, software packages creating high-resolution meshes of the > brain (such as freesurfer) exclude the cerebellum. > For the figures in the famous Schoffelen et al 2008 paper (Neuroimage) > I created the surfaces (with cerebellum) using a segmented template > MRI (using SPM) and then, after some image processing (smoothing > filling etc), called the matlab isosurface function. This gives a > triangulated surface which can be used for visualization. Note that > this procedure does not yield topologically a sphere, so it cannot be > used for inflation. > > Best, > > Jan-Mathijs > > On Apr 21, 2011, at 2:27 PM, May (Heng-Ru May TAN) wrote: > >> Hi >> >> I was wondering if there exists within the folders of Fieldtrip, >> surface source-plot MRI templates which includes the cerebellum, and >> if not, how could one create a template which consists of the >> cerebellum, too? >> >> Any help would be gratefully appreciated! >> >> Thanks. >> May >> >> _______________________________________________ >> fieldtrip mailing list >> fieldtrip at donders.ru.nl >> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > > Dr. J.M. (Jan-Mathijs) Schoffelen > Donders Institute for Brain, Cognition and Behaviour, > Centre for Cognitive Neuroimaging, > Radboud University Nijmegen, The Netherlands > J.Schoffelen at donders.ru.nl > Telephone: 0031-24-3614793 > > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip -------------- next part -------------- An HTML attachment was scrubbed... URL: From politzerahless at gmail.com Fri Apr 22 22:17:05 2011 From: politzerahless at gmail.com (Stephen Politzer-Ahles) Date: Fri, 22 Apr 2011 15:17:05 -0500 Subject: [FieldTrip] Data preprocessing after ICA artifact correction Message-ID: Hello everyone, I am interested in using FieldTrip to remove EOG artifact on my data before other processing. I followed the example at http://fieldtrip.fcdonders.nl/example/use_independent_component_analysis_ica_to_remove_eog_artifactsto remove EOG artifact across all conditions (that is to say, when I imported the data with ft_definetrial I imported all conditions into a single structure). After having done that, I hope to a) preprocess the data (re-reference, demean/baseline-correct, and maybe low-pass filter); b) separate the data such that the data for each condition is stored in a separate variable, so that it's ready for event-related averaging. However, it seems that I can't use ft_definetrial() and ft_preprocess() on data that I have already imported into FieldTrip and done ICA on. Does anyone have any example code for how I can do the above processing steps on the data after I have already done the ICA artifact correction in FieldTrip? Thank you very much, Steve Politzer-Ahles -- Stephen Politzer-Ahles University of Kansas Linguistics Department http://www.linguistics.ku.edu/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From lieneke.janssen at student.ru.nl Tue Apr 26 11:32:27 2011 From: lieneke.janssen at student.ru.nl (Lieneke. Janssen) Date: Tue, 26 Apr 2011 11:32:27 +0200 (CEST) Subject: [FieldTrip] preprocessing per channel Message-ID: <2008169134.446724.1303810347507.JavaMail.root@monoceros.zimbra.ru.nl> Dear Fieldtrippers, I was quite happy to find the possibility in fieldtrip to do preprocessing per channel instead of (the default) per trial. Unfortunately, if I say cfg.method = 'channel'; the output is overwritten with every channel that is preprocessed, so I end up only having the output from the last channel, whereas if the method is 'trial', the function nicely combines all preprocessed trials into the output file. Is there anything that can be done to get one preprocessing output file using cfg.method = 'channel';? Thanks! Best, Lieneke From eelke.spaak at donders.ru.nl Tue Apr 26 11:45:52 2011 From: eelke.spaak at donders.ru.nl (Eelke Spaak) Date: Tue, 26 Apr 2011 11:45:52 +0200 Subject: [FieldTrip] preprocessing per channel In-Reply-To: References: <2008169134.446724.1303810347507.JavaMail.root@monoceros.zimbra.ru.nl> Message-ID: Dear Lieneke, To be honest, I have never tried preprocessing per channel before, so I might not understand exactly what you mean by 'the output is overwritten with every channel that is preprocessed'. If so, please correct me :) The cfg.method option governs only how data is read from disk, not which parts of the data the preprocessing is applied to. If you only want to preprocess certain channels, you can use cfg.channel = {...} to specify which channels to preprocess. If you have different data sets (e.g., corresponding to different output structures from ft_preprocessing) that contain different channels (but the same trials), you can concatenate them by using ft_appenddata (http://fieldtrip.fcdonders.nl/reference/ft_appenddata). Hopefully this was somewhat helpful, Best, Eelke 2011/4/26 Lieneke. Janssen : > Dear Fieldtrippers, > > I was quite happy to find the possibility in fieldtrip to do preprocessing per channel instead of (the default) per trial. > > Unfortunately, if I say cfg.method = 'channel'; the output is overwritten with every channel that is preprocessed, so I end up only having the output from the last channel, whereas if the method is 'trial', the function nicely combines all preprocessed trials into the output file. > > Is there anything that can be done to get one preprocessing output file using cfg.method = 'channel';? > > Thanks! > > Best, > Lieneke > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > From H.Rossiter at ion.ucl.ac.uk Tue Apr 26 15:00:23 2011 From: H.Rossiter at ion.ucl.ac.uk (Holly Rossiter) Date: Tue, 26 Apr 2011 14:00:23 +0100 Subject: [FieldTrip] FFT on EMG data Message-ID: <002401cc0411$e7974f30$b6c5ed90$@Rossiter@ion.ucl.ac.uk> Hi, Downloading the newest version of Fieldtrip fixed the previous error but not I am getting another error following this script... D= spm_eeg_load; emg = D.ftraw(0); cfg=[]; cfg.method='mtmfft'; cfg.output='pow'; cfg.taper='hanning'; cfg.channel={'Lforearm'}; cfg.foilim= [5 80];% frequency band - foilim or just foi?? freq=ft_freqanalysis(cfg,emg); figure semilogy(freq.freq, freq.powspctrm(1,:), 'b-'); Error ??? Index exceeds matrix dimensions. Error in ==> ft_freqanalysis at 574 acttboi = squeeze(~isnan(spectrum(1,1,foiind(ifoi),:))); Error in ==> FFT_EMG at 15 freq=ft_freqanalysis(cfg,emg); Any advice would be much appreciated. Thanks, Holly -------------- next part -------------- An HTML attachment was scrubbed... URL: From daz at MIT.EDU Tue Apr 26 17:42:36 2011 From: daz at MIT.EDU (David Ziegler) Date: Tue, 26 Apr 2011 11:42:36 -0400 Subject: [FieldTrip] PLV/coherence on Neuromag gradiometer data Message-ID: <4DB6E7EC.8000601@mit.edu> Hi Fieldtrippers, I am interested in analyzing PLV or coherence in my MEG data from a Neuromag 306 system. In the past, for looking at power alone, I have calculated TFRs on the gradiometer data, then ran ft_combineplanar to average the gradiometer pairs. Should I use the same approach for calculating the cross-spectral density, or does this create any problems when I go to combine the results for gradiometer pairs? In particular, I am trying to wrap my head around how I would set up cfg.channelcmb if I want to look at all channel pairs, but then want to subsequently perform ft_combineplanar. (or maybe this is the wrong approach altogether?) Thanks, David -- David A. Ziegler Department of Brain and Cognitive Sciences Massachusetts Institute of Technology 43 Vassar St,46-5121 Cambridge, MA 02139 Tel: 617-258-0765 Fax: 617-253-1504 daz at mit.edu -------------- next part -------------- An HTML attachment was scrubbed... URL: From lieneke.janssen at student.ru.nl Wed Apr 27 10:55:33 2011 From: lieneke.janssen at student.ru.nl (Lieneke. Janssen) Date: Wed, 27 Apr 2011 10:55:33 +0200 (CEST) Subject: [FieldTrip] preprocessing per channel In-Reply-To: <414049370.459969.1303894250317.JavaMail.root@monoceros.zimbra.ru.nl> Message-ID: <1120852439.460085.1303894533421.JavaMail.root@monoceros.zimbra.ru.nl> Hi Eelke and others, Thanks for your reply. ft_appenddata might indeed solve my problem! It would be nice though if cfg.method would work the same for preprocessing per trial and preprocessing per channel. If cfg.method is not specified, fieldtrip assumes cfg.method = trial. It then preprocesses every trial subsequently and gives you one output file in which all subsequently preprocessed trials are present. Since I would like to preprocess my complete dataset as if one big trial as a first step, which apparently takes too much memory, I wanted to preprocess per channel (for all channels) instead of per trial. So I set cfg.method to channel. It then preprocesses every channel subsequently (as 'per trial'), but only gives you the output of the most recently processed channel (in contrary to 'per trial'). I therefore assume that output/data from the previously preprocessed channel gets lost (i.e. overwritten) when fieldtrip continues with the next channel. So unfortunately you end up with the output of the last preprocessed channel only. This does not happen for preprocessing per trial (i.e. ending up with the output of the last preprocessed trial only). I hope this problem can be solved sooner or later. Until then, I'll append my data :). Best, Lieneke ----- "Eelke Spaak" wrote: > From: "Eelke Spaak" > To: "Email discussion list for the FieldTrip project" > Sent: Tuesday, April 26, 2011 11:45:52 AM > Subject: Re: [FieldTrip] preprocessing per channel > > Dear Lieneke, > > To be honest, I have never tried preprocessing per channel before, so > I might not understand exactly what you mean by 'the output is > overwritten with every channel that is preprocessed'. If so, please > correct me :) > > The cfg.method option governs only how data is read from disk, not > which parts of the data the preprocessing is applied to. If you only > want to preprocess certain channels, you can use cfg.channel = {...} > to specify which channels to preprocess. If you have different data > sets (e.g., corresponding to different output structures from > ft_preprocessing) that contain different channels (but the same > trials), you can concatenate them by using ft_appenddata > (http://fieldtrip.fcdonders.nl/reference/ft_appenddata). > > Hopefully this was somewhat helpful, > Best, > > Eelke > > 2011/4/26 Lieneke. Janssen : > > Dear Fieldtrippers, > > > > I was quite happy to find the possibility in fieldtrip to do > preprocessing per channel instead of (the default) per trial. > > > > Unfortunately, if I say cfg.method = 'channel'; the output is > overwritten with every channel that is preprocessed, so I end up only > having the output from the last channel, whereas if the method is > 'trial', the function nicely combines all preprocessed trials into the > output file. > > > > Is there anything that can be done to get one preprocessing output > file using cfg.method = 'channel';? > > > > Thanks! > > > > Best, > > Lieneke > > _______________________________________________ > > fieldtrip mailing list > > fieldtrip at donders.ru.nl > > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip > > > > _______________________________________________ > fieldtrip mailing list > fieldtrip at donders.ru.nl > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip From r.oostenveld at donders.ru.nl Thu Apr 28 14:31:43 2011 From: r.oostenveld at donders.ru.nl (Robert Oostenveld) Date: Thu, 28 Apr 2011 14:31:43 +0200 Subject: [FieldTrip] change in yokogawa trigger and raw data handling Message-ID: <793850E4-B56E-4656-B755-9C8D0BCB52B9@donders.ru.nl> Dear Yokogawa users Earlier this week I made a change to the handling of Yokogawa data that might require some small updates to your analysis scripts. Let me summarise it in this mail. Although most of the meta information and header information is still read with the yokogawa p-files, the sqd data can now also be read with the sqdproject/sqdread function. As of this week the code is included in fieldtrip/external/sqdproject and will automatically be added to your path. The consequence is that much less memory is needed if you only want to read a few channels (or the trigger channels). You can now use it on a small memory computer. Another consequence is that data is expressed in fT and mV (if I am correct) and not no T and V, so please note the scaling difference. Furthermore, I have added an option to ft_read_event/read_trigger that automatically detects whether you have downgoing or upgoing flanks in the data. It used to detect both, and then it was up to you to select e.g. '169_up' as the relevant one. It will now (try to) autodetect whether your data has downgoing or upgoing flanks and only detect the triggers for the approprate one. The resulting trigger code does not have the down/up tag any more, so you should now work with '169' instead. And finally the ft_read_event function now has the 'trigindx' option documented (see also http://bugzilla.fcdonders.nl/show_bug.cgi?id=494#c2) and has an option 'threshold' for the flank detection in the analog trigger channels. best regards, Robert PS if you want to follow up to this mail with potential problems or suggestions for improvements, please use http://bugzilla.fcdonders.nl and file a "bug" for the yokogawa component. From jan.schoffelen at donders.ru.nl Fri Apr 29 12:30:13 2011 From: jan.schoffelen at donders.ru.nl (jan-mathijs schoffelen) Date: Fri, 29 Apr 2011 12:30:13 +0200 Subject: [FieldTrip] change in scaling of sine tapers Message-ID: <8E52B0AC-BA08-4B45-8CB1-89005BAE2851@donders.ru.nl> Dear all, I made a change to how ft_freqanalysis scales the tapers when cfg.taper has been specified to be 'sine'. This has been done to make the handling of this type of taper consistent with the other (multi) tapers. Each of the tapers used has now a norm of 1, which makes the scale of the powerspectrum of the tapered time series consistent across different tapers. Initially, this was not the case for the sine taper. For backward compatibility I implemented the (we think less appropriate) scaled version. In order to use the scaled sine tapers, you need to specify cfg.taper = 'sine_old' prior to calling ft_freqanalysis. Best wishes, Jan-Mathijs Dr. J.M. (Jan-Mathijs) Schoffelen Donders Institute for Brain, Cognition and Behaviour, Centre for Cognitive Neuroimaging, Radboud University Nijmegen, The Netherlands J.Schoffelen at donders.ru.nl Telephone: 0031-24-3614793