Andrea Ostendorf aostendorf at BESA.DE
Mon Jun 21 08:21:27 CEST 2010

Dear Roemer,

Thanks a lot. I discussed this topic some months ago with Robert and he
suggested that he/the Fieldtrip team could modify the code along the
following lines (I copy this from his e-mail because I think he will not
mind this)
- - - - -
I suggest to modify the low level code into two helper functions
(findcluster_chanlevel and findcluster_sourcelevel), which both should check
like this

if hastoolbox('image', 1)
  % using image processing toolbox
  my_bwlabeln = @bwlabeln;
elseif hastoolbox('spm8', 1)
  % using spm8 version
 my_bwlabeln = @spm8_bwlabeln;
- - - -

I have got SPM8 on my Matlab path and whenever I download a new Fieldtrip
version, I have to edit clusterstat and findcluster because it is (or was)
not sufficient to simply replace bwlabeln by spm_bwlabel. What I did is
probably rather inelegant but I left it that way since it works:

In findcluster:
%  [labelmat(spatdimlev, :, :), num] = bwlabeln(reshape(onoff(spatdimlev, :,
:), nfreq, ntime), 4);
input_for_spm_bwlabel = reshape(onoff(spatdimlev, :, :), nfreq, ntime);
input_for_spm_bwlabel = +input_for_spm_bwlabel; %convert from logical
[labelmat(spatdimlev, :, :), num] = spm_bwlabel(input_for_spm_bwlabel , 6);

In clusterstat:
%!!!posclusobs = bwlabeln(tmp, conndef(length(cfg.dim),'min'));
[posclusobs,L] = spm_bwlabel(tmp, 6);

Sorry for the late answer.
By the way, I have got into trouble at work because we have a betting game
going on and I predicted the Netherlands as the winner (not that I know
anything about football but I chose the Netherlands because the Fieldtrip
team is so nice)...

All the best

The aim of this list is to facilitate the discussion between users of the FieldTrip  toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/neuroimaging/fieldtrip.

More information about the fieldtrip mailing list