Skip to content

Commit

Permalink
Merge pull request #50 from SnPM-toolbox/next_release
Browse files Browse the repository at this point in the history
Preparing SnPM 13.1.07 release
  • Loading branch information
cmaumet authored Sep 29, 2017
2 parents ddcbe16 + 2ed1180 commit 34023bc
Show file tree
Hide file tree
Showing 31 changed files with 1,028 additions and 180 deletions.
674 changes: 674 additions & 0 deletions LICENCE

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@ This file describes the bugs that have been reported, along with the appropriate
Updated versions of appropriate SnPM functions are available from in the snpm13_updates:
http://warwick.ac.uk/snpm/distribution/snpm13_updates

--- SnPM 13.1.07 ---
* fix: Add GPL licence.
* fix: decrease lower bound on number of subject for approximate perms.
* enh: Table: Create TabDat structure expected by spm_list, allowing access to all peak/cluster results, even if there are too many for the SnPM results page.
* enh: Apply mlint suggestions for better compatibility with MATLAB Compiler and Octave.
* test: use latest available ground truth if perfect match for matlab version is not available.
* Version 13.1.07

--- SnPM 13.1.06 ---
* fix: ANOVA between group "all zero"/"all equal" options were flipped in the menu of the matlabbatch.
* fix: snpm_cp can now handle XYZ locations in a 1D space.
Expand Down
2 changes: 1 addition & 1 deletion config/snpm_bch_ui_Corr1S.m
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
function snpmui = snpm_bch_ui_Corr1s
function snpmui = snpm_bch_ui_Corr1S
% Example script that creates an cfg_exbranch to sum two numbers. The
% inputs are entered as two single numbers, the output is just a single
% number.
Expand Down
10 changes: 5 additions & 5 deletions snpm.m
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
if nargin == 0, Action='Init'; end


if strcmp(lower(Action),lower('Init'))
if strcmpi(Action,'Init')
%=======================================================================
global MODALITY
if isempty(spm_figure('FindWin','Menu'))
Expand All @@ -66,7 +66,7 @@
clc
end
% Add test code to Matlabpath
if ~exist('test_oneSample', 'file')
if ~exist('test_oneSample', 'file') && ~isdeployed
addpath(fullfile(spm_file(which('snpm'), 'path'), 'test'));
addpath(fullfile(spm_file(which('snpm'), 'path'), 'test', 'common'));
end
Expand All @@ -77,7 +77,7 @@
spm_help('!Disp','snpm.m','','Graphics',snpm('Ver'))
snpm('CreateMenuWin')

elseif strcmp(lower(Action),lower('AsciiWelcome'))
elseif strcmpi(Action,'AsciiWelcome')
%=======================================================================
disp( ' ___ ____ __ __ ')
disp( '/ __) ___ ( _ \( \/ ) Statistical nonParametric Mapping toolbox ')
Expand All @@ -86,12 +86,12 @@
fprintf('\n')


elseif strcmp(lower(Action),lower('Ver'))
elseif strcmpi(Action,'Ver')
%=======================================================================
% snpm('Ver')
varargout = {SnPMver};

elseif strcmp(lower(Action),lower('Colour'))
elseif strcmpi(Action,'Colour')
%=======================================================================
% snpm('Colour')
%-----------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion snpm_P_FDR.m
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
Cnj_n = abs(n); % Inf on Global Null
end

if isempty(Z),
if isempty(Z)
AllP = 1;
Z = Ps;
STAT = 'P';
Expand Down
2 changes: 1 addition & 1 deletion snpm_STcalc.m
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@
df = varargin{8};

%- determine whether the user input is a p value or real threshold
if (ST_Ut < 1),
if (ST_Ut < 1)
ST_Ut = spm_invTcdf(1-ST_Ut,df);
end

Expand Down
6 changes: 3 additions & 3 deletions snpm_abline.m
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
% Id: snpm_abline.m SnPM13 2013/10/12
% Thomas Nichols

if (nargin==2) & isstr(b)
if (nargin==2) && ischar(b)
b = lower(b);
else

Expand All @@ -36,11 +36,11 @@
XX=get(gca,'Xlim');
YY=get(gca,'Ylim');

if isstr(b) & (b=='h')
if ischar(b) && (b=='h')

g=line(XX,[a a],'LineStyle',':',varargin{:});

elseif isstr(b) & (b=='v')
elseif ischar(b) && (b=='v')

g=line([a a],YY,'LineStyle',':',varargin{:});

Expand Down
6 changes: 3 additions & 3 deletions snpm_check_nperm.m
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
function snpm_check_perm(nPerm,TotPerm)
function snpm_check_nperm(nPerm,TotPerm)
%
% Issue consistent warning messages about number of permutations
%
Expand All @@ -13,11 +13,11 @@ function snpm_check_perm(nPerm,TotPerm)
% specific warning about variability of Monte Carlo variation.

str='';
if nPerm<100 & nPerm>=0.9*TotPerm
if nPerm<100 && nPerm>=0.9*TotPerm
str = sprintf(['Very few (%d) permutations used, nonparametric P-values are very coarse (but exact).\n'...
'Smallest possible P-value is %0.4f.'],nPerm,1/nPerm);
id = 'SnPM:VeryFewPermsCoarseExactPValues';
elseif nPerm<100 & nPerm<0.9*TotPerm
elseif nPerm<100 && nPerm<0.9*TotPerm
str = sprintf(['Very few (%d) permutations used, nonparametric P-values are very coarse will vary \n'...
'substantially over repeated re-analyses.'...
'Smallest possible P-value is %0.4f.'],nPerm,1/nPerm);
Expand Down
8 changes: 4 additions & 4 deletions snpm_combo.m
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
if nargin == 0, Action='Init'; end


if strcmp(lower(Action),lower('Init'))
if strcmpi(Action,'Init')
%=======================================================================
global MODALITY
if isempty(spm_figure('FindWin','Menu'))
Expand All @@ -41,7 +41,7 @@



elseif strcmp(lower(Action),lower('AsciiWelcome'))
elseif strcmpi(Action,'AsciiWelcome')
%=======================================================================
disp( ' SnPM Combo Toolbox ')
disp( ' -----------------------------------------------------')
Expand All @@ -52,7 +52,7 @@



elseif strcmp(lower(Action),lower('CreateMenuWin'))
elseif strcmpi(Action,'CreateMenuWin')
%=======================================================================
%close(findobj(get(0,'Children'),'Tag','SnPM Menu'))

Expand Down Expand Up @@ -113,7 +113,7 @@



elseif strcmp(lower(Action),lower('Colour'))
elseif strcmpi(Action,'Colour')
%=======================================================================
% snpm_combo('Colour')
%-----------------------------------------------------------------------
Expand Down
38 changes: 19 additions & 19 deletions snpm_combo_pp.m
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ function snpm_combo_pp(CWD, job)

%-Compute critical threshold for level alpha test
%-----------------------------------------------------------------------
if alpha < 1;
if alpha < 1
c=ceil((1-alpha)*nPerm);
C_MaxT=StMaxT(c);
else
Expand All @@ -175,7 +175,7 @@ function snpm_combo_pp(CWD, job)
% significant.
%-bST flags whether spatial extent information was collected.)
bSpatEx = bST & exist(fullfile(CWD,'SnPM_ST.mat'))==2;
if bSpatEx & (C_MaxT <= ST_Ut) & (alpha ~= 1)
if bSpatEx && (C_MaxT <= ST_Ut) && (alpha ~= 1)
str = 'Voxelwise corrected threshold = %g, which is smaller ';
str = [str 'than minimum saved suprathreshold information (%g)'];
str = [str '\nAll results significant voxelwise.'];
Expand Down Expand Up @@ -232,7 +232,7 @@ function snpm_combo_pp(CWD, job)
clear pU_C_MaxT
end
clear pU_ST_Ut
if (primaryThresh < 1),
if (primaryThresh < 1)
primaryThresh = spm_invTcdf(1-primaryThresh,df);
end
end
Expand Down Expand Up @@ -328,7 +328,7 @@ function snpm_combo_pp(CWD, job)
ClInfo = zeros(8,size(SnPM_ST,2));
ClInfoEnd = 0;
for i = nPerm:-1:1
if (rem(i,10)==0)
if (rem(i,10)==0)
fprintf('\b\b\b\b%-4u',i)
drawnow
end
Expand Down Expand Up @@ -357,7 +357,7 @@ function snpm_combo_pp(CWD, job)
% all cluster info
tmpCLoc = (tmp==j);
subsubST = subSnPM_ST(:,tmpCLoc);
[tmpPeak tmpPLoc] = max(subsubST(4,:));
[tmpPeak, tmpPLoc] = max(subsubST(4,:));
tmpXYZ = subsubST(1:3,tmpPLoc);
tmpMass = sum((subsubST(4,:)-ST_Ut).^mTheta);
tmpVec = [tmpXYZ; tmpPeak; tmpCS(j); tmpMass; j; i];
Expand Down Expand Up @@ -400,12 +400,12 @@ function snpm_combo_pp(CWD, job)

fprintf('Calculating corr p-values for each voxel / cluster\n');
for ip = 1:(nPerm-1)
if rem(ip,50)==0, fprintf('.'), end
Qvox = find(ClInfo(4,:)>StMaxT(ip));
CorrPs(1,Qvox) = (nPerm-ip)/nPerm;
Qcl = find(ClInfo(5,:)>StMaxSTCS(ip));
CorrPs(2,Qcl) = (nPerm-ip)/nPerm;
end
if rem(ip,50)==0, fprintf('.'), end
Qvox = find(ClInfo(4,:)>StMaxT(ip));
CorrPs(1,Qvox) = (nPerm-ip)/nPerm;
Qcl = find(ClInfo(5,:)>StMaxSTCS(ip));
CorrPs(2,Qcl) = (nPerm-ip)/nPerm;
end
fprintf('.Done!\n');

fprintf('Calculating voxel-cluster combining functions\n');
Expand All @@ -432,9 +432,9 @@ function snpm_combo_pp(CWD, job)
end
end

[StMaxWf iStMaxWf] = sort(MaxWf);
[StMaxWt iStMaxWt] = sort(MaxWt);
[StMaxWm iStMaxWm] = sort(MaxWm);
[StMaxWf, iStMaxWf] = sort(MaxWf);
[StMaxWt, iStMaxWt] = sort(MaxWt);
[StMaxWm, iStMaxWm] = sort(MaxWm);
C_Wcomb = zeros(4,1);
if alpha < 1
C_Wcomb(1) = StMaxWf(c);
Expand Down Expand Up @@ -481,7 +481,7 @@ function snpm_combo_pp(CWD, job)


% Corrected critical meta-statistic
[StMaxWa iStMaxWa] = sort(MaxWa);
[StMaxWa, iStMaxWa] = sort(MaxWa);
if alpha < 1
C_Wcomb(4) = StMaxWa(c);
else
Expand Down Expand Up @@ -524,7 +524,7 @@ function snpm_combo_pp(CWD, job)
for i = 1:nSTC
tQ = find(STCstats(6,:)==i);
ttQ= find(ClInfo(7,:)==i & ClInfo(8,:)==1);
if ( STCS(i) > C_STCS | max(STCstats(4,tQ)) > C_MaxT | ...
if ( STCS(i) > C_STCS || max(STCstats(4,tQ)) > C_MaxT || ...
max(ComboF(iW,ttQ)) > C_Wcomb(iW))
Q = [Q tQ];
end
Expand Down Expand Up @@ -560,7 +560,7 @@ function snpm_combo_pp(CWD, job)
tmp='voxels'; if bSpatEx, tmp='suprathreshold clusters'; end
text(0,0.93,sprintf(...
'No %s significant at alpha=%6.4f (corrected)',tmp,alpha));
if bSpatEx,
if bSpatEx
ShowDist(MaxT,C_MaxT,MaxSTCS,C_STCS);
else
ShowDist(MaxT,C_MaxT);
Expand Down Expand Up @@ -765,7 +765,7 @@ function snpm_combo_pp(CWD, job)
%-----------------------------------------------------------------------
r = 1;
bUsed = zeros(size(STC_SnPMt));
while max(STC_SnPMt.*(~bUsed)) & (y > 3)
while max(STC_SnPMt.*(~bUsed)) && (y > 3)

[null, i] = max(STC_SnPMt.*(~bUsed)); % Largest t value
j = find(STC_r == STC_r(i)); % Maxima in same region
Expand Down Expand Up @@ -812,7 +812,7 @@ function snpm_combo_pp(CWD, job)
for i = 1:length(k)
d = j(k(i));
if min( sqrt( sum((STC_XYZ(:,D) - ...
STC_XYZ(:,d)*ones(1,size(D,2))).^2) ) ) > 8;
STC_XYZ(:,d)*ones(1,size(D,2))).^2) ) ) > 8
if length(D) < 3

text(tCol(5)+0.08,y,sprintf(Fmtst{5},Pt(d)),...
Expand Down
Loading

0 comments on commit 34023bc

Please sign in to comment.