Back to the main page.

Bug 1316 - use spm_bwlabel also for 2D data

Status CLOSED FIXED
Reported 2012-02-08 10:48:00 +0100
Modified 2012-03-14 10:00:43 +0100
Product: FieldTrip
Component: core
Version: unspecified
Hardware: PC
Operating System: Mac OS
Importance: P3 minor
Assigned to: Eelke Spaak
URL:
Tags:
Depends on:
Blocks:
See also:

Robert Oostenveld - 2012-02-08 10:48:07 +0100

line 188 in private/clusterstat.m is if length(cfg.dim) == 3 % if source data (3D) ft_hastoolbox('spm8',1); [posclusobs, posnum] = spm_bwlabel(tmp, 6); % use spm_bwlabel for source data to avoid usage of image toolbox else posclusobs = bwlabeln(tmp, conndef(length(cfg.dim),'min')); % spm_bwlabel yet (feb 2011) supports only up to 3-D data end So in case dim==3 it uses spm, and in case 2 it uses the imageproc toolbox. However the comment suggests that spm can also be used for dim==1 and dim==2. This should be checked. The actual case might not happen very often, but it is better to make the code robust. Perhaps a test would be to make a 2-d sheet with xgrid=-10:10, ygrid=-10:10 anbd zgrid=40; There is also old code hanging around that is never reached. That should be removed.


Eelke Spaak - 2012-02-08 10:49:56 +0100

I can confirm that spm_bwlabel also supports 1D/2D input (have used this myself).


Eelke Spaak - 2012-02-08 15:01:26 +0100

Fixed in revision 5263. Note that spm_bwlabel actually does *not* support 1D data, contrary to what I said earlier. 2D/3D is fine.


Eelke Spaak - 2012-03-14 10:00:43 +0100

closing several bugs that have been RESOLVED for a long time