Skip to content

Commit

Permalink
fixed strange infrequent bug in cluster size
Browse files Browse the repository at this point in the history
Once in a long while, no voxels would be above primary threshold, and
null hypothesis cluster extent size would fail. This was an easy fix to
return size = 0 in those cases.
  • Loading branch information
torwager committed Jul 11, 2016
1 parent 4148cc8 commit be87b81
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -115,16 +115,22 @@
% save max cluster size info
wh = find(ivectors >= prop);

% If empty, no voxels above threshold
if isempty(wh), maxcsize = 0; return, end

if length(wh) > 50000, maxcsize = Inf; end

xyz = xyzlist(wh,:)';
clust = spm_clusters(xyz);
u = unique(clust);

clsize = []; % init to avoid error in Matlab 2013/csize is a function
for i = 1:length(u)
clsize(i) = sum(clust == i);
end

maxcsize = max(clsize);

return


Expand Down

0 comments on commit be87b81

Please sign in to comment.