[FieldTrip] ANNOUNCEMENT: change of source data structure, source.inside now logical rather than indices

Johanna Fiess Johanna.Fiess at uni-konstanz.de
Fri Feb 6 17:23:25 CET 2015


 Hallo Christian,

ich weiß nicht, ob Du auch auf dem Verteiler bist - und ob diese Änderung für Dich von Interesse ist. Schicke es Dir einfach mal weiter.

Viele Grüße und ein schönes WE
Hanna
 
 
Am Freitag, 06. Februar 2015 15:19 CET, Robert Oostenveld <r.oostenveld at donders.ru.nl> schrieb: 
 
> Dear FieldTrip users,
> 
> For a long time we have been planning to make some changes in the representation of source-reconstructed data. These changes should facilitate the maintenance of the code, the reuse of functionality and accomodate future extensions. Over the last few days I have been working on a first set of changes to the code that affect how the source positions inside the brain are represented. 
> It used to be the case that source.inside and source.outside could be two vectors, containing the indices (i.e. 1, 2, 3, …) of source positions that are inside or outside the brain, respectively. I.e. the combined length of both vectors was equal to size(source.pos.1). In some cases however, the source.inside was represented as a boolean/logical vector with a true or false (a 1 or 0) value for each source position. With this logical representation, there is no need for source.outside.
> 
> To improve consistency between the source and the volume representation, and to facilitate working with parcellated brain atlases, we have decided to move to a consistent implementation throughout FieldTrip that always uses the boolean/logical representation. So all FieldTrip functions will from now on return source.inside as a boolean vector.
> 
> The consequence is that the code in your scripts such as
> 
> for i=1:length(source.inside)
>  select = source.inside(i);
>   % do something with the selected source end
> 
> will fail, since source.inside will only contain 0 or 1 values.  If the source.inside vector has a 0 (i.e. not inside the brain), it will fail, since 0 is not a valid index. This is something you will notice, as MATLAB will give an error. If all values in source.inside vector are 1 (i.e. all inside the brain), MATLAB might not give an error immediately, but the result of the computation is not what it should be, since the computation is repeated over and over for source position 1 rather than all source positions.
> 
> To get the original behavour with the indices, please use some code like this
>   insideindx = find(source.inside)
> and then loop over all elements of insideindx.
> 
> 
> Appologies for the inconvenience this might cause.
> 
> best regards,
> Robert
> 
> 
> PS another upcoming change will be that in the near future we will also deprecate the source.avg and the source.trial sub-structures. Instead of these sub-structures, the results of the source reconstruction will be represented at the top-level of the source structure, as is the case with all other data representations. Please see the ft_datatype_source function (or http://fieldtrip.fcdonders.nl/reference/ft_datatype_source) for an example of the new representation with source.pow rather than source.avg.pow.
> 
>  _______________________________________________
> fieldtrip mailing list
> fieldtrip at donders.ru.nl
> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
 
-- 
Dipl.-Psych. Johanna Fiess
 
Fachbereich Psychologie
Universität Konstanz
Postfach 905
78457 Konstanz
 
Telefon: +49-(0)7531-88-4604
Fax: +49-(0)7531-88-4601 





More information about the fieldtrip mailing list