Back to the main page.

Bug 2053 - implement roi selection in ft_selectdata

Reported 2013-03-13 15:48:00 +0100
Modified 2017-12-15 09:59:40 +0100
Product: FieldTrip
Component: core
Version: unspecified
Hardware: PC
Operating System: Mac OS
Importance: P3 normal
Assigned to: Robert Oostenveld
Depends on:
Blocks: 3391
See also:

Robert Oostenveld - 2013-03-13 15:48:26 +0100

ft_sourcestatistics currently can do % You can restrict the statistical analysis to regions of interest (ROIs) % or to the average value inside ROIs using the following options: % cfg.atlas = filename of the atlas % cfg.roi = string or cell of strings, region(s) of interest from anatomical atlas % cfg.avgoverroi = 'yes' or 'no' (default = 'no') % cfg.hemisphere = 'left', 'right', 'both', 'combined', specifying this is % required when averaging over regions % cfg.inputcoord = 'mni' or 'tal', the coordinate system in which your source % reconstruction is expressed whereas ft_selectdata cannot.

Robert Oostenveld - 2013-03-13 15:49:50 +0100

actually, ft_selectdata_new cannot do anything with a source structure yet. For bug 2051 (which I thought was a quicky), I am now implementing rudimentary support for source in ft_selectdata_new

Robert Oostenveld - 2013-03-13 17:35:25 +0100

I just committed r7661 mentioning this bug in the log message. It should have been bug 2051 instead

Johanna - 2015-02-27 13:24:59 +0100

Hi Robert, I just needed this for my own use, and so added the functionality to the existing framework. I noticed you recently assigned this to yourself. Below is the output of 'svn diff utilities/ft_selectdata.m'. Is it ok with you that I commit this change, or would you prefer it implemented another way? Index: utilities/ft_selectdata.m =================================================================== --- utilities/ft_selectdata.m (revision 10263) +++ utilities/ft_selectdata.m (working copy) @@ -32,6 +32,11 @@ % cfg.frequency = [beg end] % cfg.avgoverfreq = string, can be 'yes' or 'no' (default = 'no') % +% For data with a pos dimension you can specify +% cfg.coordinate = 'all' (default) +% cfg.coordinate = Nx3 coordinate list, in same dimension/space as data.pos +% cfg.avgoverpos = string, can be 'yes' or 'no' (default = 'no') +% % If multiple input arguments are provided, FT_SELECTDATA will adjust the individual inputs % such that either the intersection across inputs is retained (i.e. only the channel, time, % and frequency points that are shared across all input arguments), or that the union across @@ -140,6 +145,7 @@ = ft_getopt(cfg, 'channel', 'all', 1); cfg.trials = ft_getopt(cfg, 'trials', 'all', 1); +cfg.coordinate = ft_getopt(cfg, 'coordinate', 'all', 1); if length(varargin)>1 && ~isequal(cfg.trials, 'all') error('it is ambiguous to make a subselection of trials while at the same time concatenating multiple data structures') @@ -1130,7 +1136,13 @@ end for i=1:ndata - posindx{i} = nan; % the nan return value specifies that no selection was specified + if isequal(cfg.coordinate, 'all') + posindx{i} = nan; % the nan return value specifies that no selection was specified + elseif size(cfg.coordinate,2)==3 + posindx{i} = dsearchn(varargin{i}.pos,cfg.coordinate); + else + error('incorrectly specified cfg.coordinate'); + end end end % function getselection_pos

Johanna - 2016-01-15 13:36:04 +0100

(In reply to Johanna from comment #3) Hi Robert, I'm just going through all my uncommited changes in my local copy and found this one. Shall I commit the change as in my previous post or do you have an alternative suggestion? Thank you, JOhanna