Back to the main page.

Bug 1600 - .inside not updated in ft_checkdata(data,'datatype','source')

Reported 2012-07-06 14:55:00 +0200
Modified 2012-11-29 09:13:23 +0100
Product: FieldTrip
Component: core
Version: unspecified
Hardware: PC
Operating System: Windows
Importance: P3 normal
Assigned to: Jan-Mathijs Schoffelen
Depends on:
See also:

Johanna - 2012-07-06 14:55:50 +0200

when data is of type 'volume'. Instead, .inside remains a matrix e.g. [181 217 181], rather than Nx1 list. Does this matter? or is it ok/intended to leave .inside matching the .dim, which is supposed to be [181 217 181] ?

Jan-Mathijs Schoffelen - 2012-07-06 15:44:57 +0200

the inside-field is a vector in a source-structure, but should be a 3D-boolean matrix in a volume-structure (this is just a matter of definition). So I guess in your case this is how it is and indeed intended.

Johanna - 2012-07-06 15:49:42 +0200

Ok. Sorry I didn't clarify this, but I meant that the output of data_new=ft_checkdata(data_volume,'datatype','source'), when data_volume is type 'volume' is converted so that data_new is type 'source', but it still has the 3D-boolean matrix for .inside. I agree data_volume.inside should have the 3D boolean, but shouldn't data_new.inside be a vector?

Jan-Mathijs Schoffelen - 2012-07-06 16:17:54 +0200

I think so, too. There should be a private function fixinside that could take care of this. Apparently, it is not properly called...

Johanna - 2012-07-06 16:38:04 +0200

fixinside is indeed only called if the input parameter/flag called 'inside' is not empty. How should this be changed? 1) Is ft_checkdata correct, but the call to it from ft_sourcegrandaverage (for example) incorrect? (requiring something like data_source=ft_checkdata(data_volume,'datatype','source','inside',something) or 2) should ft_checkdata be modified around lines 389?

Jan-Mathijs Schoffelen - 2012-11-28 15:31:14 +0100

--- ft_checkdata.m (revision 7013) +++ ft_checkdata.m (working copy) @@ -605,7 +605,7 @@ % these fields should not be reshaped exclude = {'cfg' 'fwhm' 'leadfield' 'q' 'rough' 'pos'}; - if ~strcmp(inside, 'logical') + if ~isempty(inside) && ~strcmp(inside, 'logical') % also exclude the inside/outside from being reshaped exclude = cat(2, exclude, {'inside' 'outside'}); end bash-3.2$ svn commit ft_checkdata.m Sending ft_checkdata.m Transmitting file data . Committed revision 7029.

Jan-Mathijs Schoffelen - 2012-11-28 15:32:38 +0100

bash-3.2$ svn add test_bug1600.m A test_bug1600.m bash-3.2$ svn commit test_bug1600.m Adding test_bug1600.m Transmitting file data . Committed revision 7031.