Code Martin Pyka on 28 May 2010 04:50 pm
The “extent threshold” function deletes all clusters in a given contrast image that consist of less than k voxels. The corresponding matlab code can be found in spm_getSPM.m (line 674f). In case you would like to use this code manually for other imaging data, here is a matlab-function called extentThreshold that allows you to apply the extent threshold on a 3d volume of your choice.
The function can be used in the following way: if data is a 3d-matrix (of let’s say voxel values) and you want to display clusters with voxels that are greater than zero and with a cluster size of at least 20, write:
indices = find(data>0);
newdata = extentThreshold(data, indices, 20);
newdata includes only the elements of data that are greater than zero and that belong to a cluster with at least 20 other elements exceeding this threshold.