[FieldTrip] Value per parcel after running ft_virtualchannel

Schoffelen, J.M. (Jan Mathijs) janmathijs.schoffelen at donders.ru.nl
Wed Feb 1 10:03:11 CET 2023

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

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

More information about the fieldtrip mailing list