[FieldTrip] Value per parcel after running ft_virtualchannel

Marta Stojanović marta.stojanovic at student.uva.nl
Wed Feb 1 12:04:34 CET 2023

Hi Jan-Mathijs,

Thanks a lot for your reply, that’s once again very helpful.


From: fieldtrip <fieldtrip-bounces at science.ru.nl> on behalf of "Schoffelen, J.M. (Jan Mathijs) via fieldtrip" <fieldtrip at science.ru.nl>
Reply to: FieldTrip discussion list <fieldtrip at science.ru.nl>
Date: Wednesday, 1. February 2023 at 10:42
To: FieldTrip discussion list <fieldtrip at science.ru.nl>
Cc: "Schoffelen, J.M. (Jan Mathijs)" <janmathijs.schoffelen at donders.ru.nl>
Subject: Re: [FieldTrip] Value per parcel after running ft_virtualchannel

Hi Marta,

Perhaps you could try to pass your data (containing a ‘brainordinate’ field that is consistent with the parcels in the data) through ft_checkdata: ft_checkdata(parcellateddata, ‘datatype’, ’source’);

Best wishes,

On 31 Jan 2023, at 12:02, Marta Stojanović <marta.stojanovic at student.uva.nl<mailto:marta.stojanovic at student.uva.nl>> wrote:

Hi Jan-Mathijs,

Thanks a lot for your reply! Apologies for not being entirely clear in the question behind my question. The question is most related to visualization – I want to visualize the alpha power from single trial MEG source data per parcel (parcellated according to a brain atlas). I am sure that I need to use ft_virtualchannel because by using this function I can keep the trials and trial info after parcellating the single trial source data, which I cannot otherwise seem to keep using ft_sourceparcellate.

Thanks so much for all the information, this was very helpful. I am only still slightly unsure about how to implement what you wrote in your last paragraph: (QUOTE) “map the scalars back onto the original volume, and then you could use ft_sourceinterpolate to obtain a data structure that maps the low resolution volume back onto a high resolution volume (containing a template anatomical image), so that you can visualize it in ft_sourceplot.” Do you mind expanding upon how one would map the scalars back to the original volume? Apologies if this is quite straightforward, I’m just slightly confused by the phrasing here.

Thanks a lot again and all the best,

From: fieldtrip <fieldtrip-bounces at science.ru.nl<mailto:fieldtrip-bounces at science.ru.nl>> on behalf of "Schoffelen, J.M. (Jan Mathijs) via fieldtrip" <fieldtrip at science.ru.nl<mailto:fieldtrip at science.ru.nl>>
Reply to: FieldTrip discussion list <fieldtrip at science.ru.nl<mailto:fieldtrip at science.ru.nl>>
Date: Friday, 27. January 2023 at 10:43
To: FieldTrip discussion list <fieldtrip at science.ru.nl<mailto:fieldtrip at science.ru.nl>>
Cc: "Schoffelen, J.M. (Jan Mathijs)" <janmathijs.schoffelen at donders.ru.nl<mailto:janmathijs.schoffelen at donders.ru.nl>>
Subject: Re: [FieldTrip] Value per parcel after running ft_virtualchannel

Hi Marta,

I must say that I don’t understand the question behind your question. What is it you want to achieve? You mention that you wish to know about (QUOTE) "the most effective way to replicate this output/reshape the output of ft_virtualchannel or somehow with ft_virtualchannel in the easiest possible way obtain one value per parcel”. And then you mention a few data structures that in part seem to have been handcrafted. What is it what you want to achieve? Are you sure that ft_virtualchannel is the function you want to use? Is the question underlying your question related to visualization, statistics, something else?

The purpose of ft_virtualchannel - as it’s name suggests - is to create a data structure that contains virtual channels, i.e. a representation of data that behaves as if it’s channel level data, but now with each of the channels representing time series (or frequency domain fourier spectra) mapped onto a location/parcel in source space. The output of ft_virtualchannel can be further processed to obtain derived quantities from the time series, e.g. a value that represent the power in a particular frequency band, for instance the alpha band. In order to obtain that, one would run ft_freqanalysis on the output of ft_virtualchannel, and e.g. followed by ft_selectdata with a specified frequency range, and avgoverfreq = ‘yes’. Then, in order to visualize the result, one would require the mapping from the individual virtual channels to the original source space, which is represented in the brainordinate field, which in your case seems to be a low resolution 3D-grid based representation of an anatomical atlas that is defined on a volume.

I don’t know by heart what (and whether there exists any) the smoothest procedure will be for visualization in FT. If there is no mention anywhere in the documentation to visualize this easily, I suspect that you need to map the scalars back onto the original volume, and then you could use ft_sourceinterpolate to obtain a data structure that maps the low resolution volume back onto a high resolution volume (containing a template anatomical image), so that you can visualize it in ft_sourceplot.

Good luck, and happy computing,

On 26 Jan 2023, at 17:53, Marta Stojanović via fieldtrip <fieldtrip at science.ru.nl<mailto:fieldtrip at science.ru.nl>> wrote:


I hope this email finds you well. I have a question about obtaining one power value per parcel after using ft_virtualchannel. I guess there must be a way to create a dummy struct that could solve this problem, so apologies if there is a straightforward answer, but I am finding it hard to obtain one value per parcel after interpolating source data onto an atlas and running ft_virtualchannel.

I run ft_virtualchannel instead of ft_sourceparcellate because I want to keep trial information which I couldn’t keep with the output of ft_sourceparcellate. The output of ft_virtualchannel that I obtain through this looks like:

  struct with fields:

            trial: [142×246×1018 double]
            time: [1×1018 double]
            dimord: 'rpt_chan_time'
            label: {246×1 cell}
            cfg: [1×1 struct]
            grad: [1×1 struct]
            sampleinfo: [142×2 double]
            trialinfo: [142×2 double]
            brainordinate: [1×1 struct]

After I use some fields from a previously generated average of alpha power along with fields from the ft_virtualchannel output to create the following dummy source struct:

     trial: [142×246 double]
     time: 0
     cfg: [1×1 struct]
     dim: [26 33 28]
     pos: [24024×3 double]
     pow: [24024×1 double]

The data is collapsed across time, but the pow field is the multiplication of the dimensions of the tissue (26 * 33 * 28), rather than a value per parcel.

I know from the Fieldtrip tutorials online that the output of ft_sourceparcellate can look like this:

parcel =
           label: {1x116 cell}   % brain parcels labels
           anatomy: [116x1 double]
           anatomydimord: 'chan_unknown'
           pow: [116x1 double] % one value of brain activity per parcel
           powdimord: 'chan'
           brainordinate: [1x1 struct]
           cfg: [1x1 struct]

I’m wondering if you could perhaps point me to the most effective way to replicate this output/reshape the output of ft_virtualchannel or somehow with ft_virtualchannel in the easiest possible way obtain one value per parcel. Essentially, I’m most interested in replicating or obtaining the ‘pow’ field from the ft_sourceparcellate output where I would have one power or activity estimate per parcel.

I hope the question makes sense, and I can of course elaborate or explain further if not. Either way, thanks a lot in advance!

All the best,

fieldtrip mailing list
https://mailman.science.ru.nl/mailman/listinfo/fieldtrip<https://urldefense.com/v3/__https://eur04.safelinks.protection.outlook.com/?url=https*3A*2F*2Furldefense.com*2Fv3*2F__https*3A*2F*2Feur04.safelinks.protection.outlook.com*2F*3Furl*3Dhttps*3A*2F*2Fmailman.science.ru.nl*2Fmailman*2Flistinfo*2Ffieldtrip*26data*3D05*7C01*7Cmarta.stojanovic*40student.uva.nl*7C58e4eaf056504b0cd8e908db004afc2a*7Ca0f1cacd618c4403b94576fb3d6874e5*7C0*7C0*7C638104094288260531*7CUnknown*7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0*3D*7C3000*7C*7C*7C*26sdata*3DsjTecY3XWmq*2Fg7U8h9xZuolrxSY6lU21lgVCNj7HF*2Fs*3D*26reserved*3D0__*3BJSUlJSUlJSUlJSUlJSUlJSUlJSUlJSUl!!HJOPV4FYYWzcc1jazlU!-r4B61NaMQFYSVEzgFzvuYA23IHJhdyk9ZqzMIBwxSvXzrUbHiCTjCmxQrtORHfiSYefox6Ys9Sv9tQntOtwHMGv-ghjipow0UFwEBP3OAABft7I*24&data=05*7C01*7Cmarta.stojanovic*40student.uva.nl*7Cf737dc2571c54485108208db0438a0e1*7Ca0f1cacd618c4403b94576fb3d6874e5*7C0*7C0*7C638108413505984769*7CUnknown*7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0*3D*7C3000*7C*7C*7C&sdata=*2F8JnOWkXHinPiAgh6WOG*2FQzsCuBgzCSjxGibyBVcnO4*3D&reserved=0__;JSUlJSUlJSUlJSUqKioqKiolJSoqKioqKioqKioqKioqKiUlKioqJSUlJSUlJSUlJSUlJSUlJSUlJSUlJQ!!HJOPV4FYYWzcc1jazlU!5pzaEO5kgwx4L2C5NbuuK-YpTQLwBGIgWNTzKp6JuAse27yo4QTPXOkyTXvBcbYsEMw9mMwyi1xfWls05vBdYaXLkqPbBgmXWXS4C84$ >
https://urldefense.com/v3/__https://doi.org/10.1371/journal.pcbi.1002202__;!!HJOPV4FYYWzcc1jazlU!8FT62BXQNEdwl2ym7MPEQPvYBcvuo-W43pLyc6ErhtPG0h_Hp9l1IoqOijJMJZURZi3EiUNhvyTmqzhBhs0cuQQkEAHPRgVe3c7Egw$<https://urldefense.com/v3/__https://eur04.safelinks.protection.outlook.com/?url=https*3A*2F*2Furldefense.com*2Fv3*2F__https*3A*2F*2Feur04.safelinks.protection.outlook.com*2F*3Furl*3Dhttps*3A*2F*2Furldefense.com*2Fv3*2F__https*3A*2F*2Fdoi.org*2F10.1371*2Fjournal.pcbi.1002202__*3B!!HJOPV4FYYWzcc1jazlU!8FT62BXQNEdwl2ym7MPEQPvYBcvuo-W43pLyc6ErhtPG0h_Hp9l1IoqOijJMJZURZi3EiUNhvyTmqzhBhs0cuQQkEAHPRgVe3c7Egw*24*26data*3D05*7C01*7Cmarta.stojanovic*40student.uva.nl*7C58e4eaf056504b0cd8e908db004afc2a*7Ca0f1cacd618c4403b94576fb3d6874e5*7C0*7C0*7C638104094288260531*7CUnknown*7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0*3D*7C3000*7C*7C*7C*26sdata*3D8kvEnFGbFD1Xm8qs4Ne1yJHGgotobY75Fqz5y4mgdDQ*3D*26reserved*3D0__*3BJSUlJSUlJSUlJSUlJSUlJSUlJSUlJSUlJSUlJQ!!HJOPV4FYYWzcc1jazlU!-r4B61NaMQFYSVEzgFzvuYA23IHJhdyk9ZqzMIBwxSvXzrUbHiCTjCmxQrtORHfiSYefox6Ys9Sv9tQntOtwHMGv-ghjipow0UFwEBP3OAM2IEEO*24&data=05*7C01*7Cmarta.stojanovic*40student.uva.nl*7Cf737dc2571c54485108208db0438a0e1*7Ca0f1cacd618c4403b94576fb3d6874e5*7C0*7C0*7C638108413506140998*7CUnknown*7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0*3D*7C3000*7C*7C*7C&sdata=wwIFC166rPmoLagzkpXWLuCeHRuVnROxVfUbHvfITfc*3D&reserved=0__;JSUlJSUlJSUlJSUqKioqKioqKioqKiolJSoqKioqKioqKioqKioqKiUlKiUlJSUlJSUlJSUlJSUlJSUlJSUl!!HJOPV4FYYWzcc1jazlU!5pzaEO5kgwx4L2C5NbuuK-YpTQLwBGIgWNTzKp6JuAse27yo4QTPXOkyTXvBcbYsEMw9mMwyi1xfWls05vBdYaXLkqPbBgmXeojm30o$ >

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20230201/5a374fa0/attachment.htm>

More information about the fieldtrip mailing list