[FieldTrip] How to apply ROI mask to grandavg (Sonja Suntrup-Kr?ger)

RICHARDS, JOHN RICHARDS at mailbox.sc.edu
Sat Aug 19 14:55:29 CEST 2017

Sonja. You are definitely on the right track.

     pow: [7109137x6 double]  (because there are 6 datasets in the grandavg)
     pos: [7109137x3 double]
     dim: [181 217 181]

The dim are the size of the cube for your source model matrix.  The pow/pos and other matrices are linear.   The linear arrays are a little easier to manipulate, may be the reason that FT decided to use these rather than have 3D matrices.  181*217*181 = 7109137.

If you create a ROI matrix, it would either be of dimensions, N-ROI X 181 X 217 X 181, or more conveniently you could reshape it into a N-ROI x 7109137.

Then multiply the ROI matrix * the pow, e.g., 
[N-ROI X 7109137] * [7109137 X 6] = N-ROI * 6. 

This would sum across each voxel in the source model matrix for each roi.  You can imagine a single ROI of the entire source model (1 x N-dipoles), this would sum across all voxels in the source model.

Or a single ROI, say of the IFG, in the ROI matrix, would give you the sum of the CDR pow data in the IFG.  Or 10 selected ROIs;  etc etc.

I also often put the POW data into a MRI volume.  In the MATLAB format a NIFTI MRI volume struct representing this source model would have a img member that is 181 x 217 x 181.  You can simply assign the POW to the img model to get the CDR data into the MRI volume, e.g., MRIVOLUME.img = pow.  Then save or manipulate the MRI volume struct.


John E. Richards
Carolina Distinguished Professor
Department of Psychology
University of South Carolina
Columbia, SC  29208
Dept Phone: 803 777 2079
Fax: 803 777 9558
Email: richards-john at sc.edu
HTTP: jerlab.psych.sc.edu

-----Original Message-----
From: fieldtrip-bounces at science.ru.nl [mailto:fieldtrip-bounces at science.ru.nl] On Behalf Of fieldtrip-request at science.ru.nl
Sent: Saturday, August 19, 2017 6:00 AM
To: fieldtrip at science.ru.nl
Subject: fieldtrip Digest, Vol 81, Issue 16

Send fieldtrip mailing list submissions to
	fieldtrip at science.ru.nl

To subscribe or unsubscribe via the World Wide Web, visit
or, via email, send a message with subject or body 'help' to
	fieldtrip-request at science.ru.nl

You can reach the person managing the list at
	fieldtrip-owner at science.ru.nl

When replying, please edit your Subject line so it is more specific than "Re: Contents of fieldtrip digest..."

Today's Topics:

   1. How to apply ROI mask to grandavg (Sonja Suntrup-Kr?ger)
   2. Problem with coordinate systems when creating head model
      (Maria Hakonen)
   3. bias in cluster stats from density of frequency	sampling?
      (Nick Ketz)


Message: 1
Date: Fri, 18 Aug 2017 12:45:31 +0200 (CEST)
From: Sonja Suntrup-Kr?ger  <s.suntrup-krueger at uni-muenster.de>
To: <fieldtrip at science.ru.nl>
Subject: [FieldTrip] How to apply ROI mask to grandavg
	<permail-201708181045318218e1ae00002392-s_sunt01 at message-id.uni-muenster.de>
Content-Type: text/plain; charset=iso-8859-1

Dear all,

I want to compare task-related brain activation in a ROI  in two groups of subjects. I performed LCMV beamformer analysis on single subject data and, after normalization, created a grandaverage of each group, which I need to compare statistically within a defined ROI. 
Since the option to create a ROI in ft_sourcestatistis is unfortunately no longer available since 2015, I had the following idea to create my ROI:
By using ft_volumelookup I created a binary mask from an anatomical atlas indicating my ROI in standard space. Now I would like to apply this mask on my grandaverage data. In specific, I want to multiply my mask values (zeros and ones) with the "pow" values in my grandavg.
This would set all the power values outside my ROI to zero. With the result from this procedure I can then calculate my statistc.

My binary mask has the dimensions: x,y,z
     mask [181x217x181 logical]
     coordsys: 'spm'

In my grandavg, the dimension "dim" is the same, but the power values ("pow") and their positions ("pos") are listed as a single long  vector for each subject:
     pow: [7109137x6 double]  (because there are 6 datasets in the grandavg)
     pos: [7109137x3 double]
     dim: [181 217 181]
     coordsys: 'spm'

My question is: How does the "x,y,z"-data structure of "dim" relate to the "single long vector"-data structure of "pow"/"pos"? If I had this information, I could transform my mask into the same structure and apply it as explained above.

Your help is greatly appreciated.
Thank you very much!
Sonja Suntrup-Kr?ger

Sonja Suntrup-Krueger, MD
Assistant Professor of Neurology
Institute for Biomagnetism and Biosignalanalysis University of Muenster, Germany


More information about the fieldtrip mailing list