Skip to content

Commit

Permalink
Merge pull request #27 from nicholst/SnPM13.1.06
Browse files Browse the repository at this point in the history
SnPM 13.1.06 including #25 and #26
  • Loading branch information
Camille Maumet authored Oct 18, 2016
2 parents f254ffc + 87c838a commit 09999a2
Show file tree
Hide file tree
Showing 8 changed files with 51 additions and 11 deletions.
10 changes: 3 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,16 @@ The SnPM toolbox provides an alternative to the Statistics section of [SPM](http
### Testing

#### Initial set up
The first time you run the tests, you will first have to create a set of ground truth data and a file named `snpm_test_config.m` containing the reference SnPM version you used to compute the ground truth and the path to the ground truth folder. For example:
The first time you run the tests, you will need to set up the `snpm_test_config.m` file to fill in `testDataDir` with the path to your ground truth folder. For example:
```
global testDataDir;
testDataDir = '~/snpm_test_data';
global SnPMrefVersion;
SnPMrefVersion = 'SnPM8';
```

#### Run the test suite
Then, the tests can be started (from the test data folder) with:
Then, the tests can be started with:
```
import matlab.unittest.TestSuite;
suite = TestSuite.fromFolder(fullfile(spm_str_manip(which('snpm'), 'h'), 'test'));
result = run(suite);
snpm_tests
```

#### Run a single test
Expand Down
5 changes: 5 additions & 0 deletions README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ 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.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.
* Version 13.1.06 (`snpm`)

--- SnPM 13.1.05 ---
* fix: two-sample t-test with nscans>12 was errored due to call to undefined variable `nPerm` (bug introduced in previous release: 13.1.4) (`snpm_pi_TwoSampT`)
* fix: warning on size of `SnPM_ST.mat` was never raised
Expand Down
2 changes: 1 addition & 1 deletion config/snpm_bch_ui_ANOVAbtwnS.m
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
nullHypAllZero.tag = 'nullHypAllZero';
nullHypAllZero.name = 'Null Hypothesis';
nullHypAllZero.labels = {'Groups are all equal' 'Groups are all zero'};
nullHypAllZero.values = {true false};
nullHypAllZero.values = {false true};
nullHypAllZero.help = {'','Null Hypothesis: Groups are all zero|all equal.'};


Expand Down
7 changes: 6 additions & 1 deletion snpm.m
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@

%-Parameters
%-----------------------------------------------------------------------
SnPMver = 'SnPM13.1.05';
SnPMver = 'SnPM13.1.06';

%-Format arguments
%-----------------------------------------------------------------------
Expand All @@ -65,6 +65,11 @@
else
clc
end
% Add test code to Matlabpath
if ~exist('test_oneSample', 'file')
addpath(fullfile(spm_file(which('snpm'), 'path'), 'test'));
addpath(fullfile(spm_file(which('snpm'), 'path'), 'test', 'common'));
end
snpm_defaults;
[Finter,Fgraph,CmdLine] = spm('FnUIsetup','Statistical non-Parametric Mapping (SnPM)');
snpm_init; % Initialize Matlab Batch system
Expand Down
8 changes: 8 additions & 0 deletions snpm_STcalc.m
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,14 @@
end

[N,Z,M,A] = spm_max(ST,XYZ);

% Enfore A to be a column vector. When XYZ locations are defined in a 1D
% space, spm_max returns A as a row vector instead of a column which
% makes find(A==i) fails later in the code below.
if size(A,2) > 1
A = A';
end

Aindex = spm_clusters(XYZ); %- cluster indexes

STCS = snpm_STcalc('initK',STCS,max(A),isPos,perm);
Expand Down
14 changes: 12 additions & 2 deletions test/common/generic_test_snpm.m
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,19 @@ function setGlobals(testCase)
% Disable warning on very small number of permutations
warning('off','SnPM:VeryFewPermsCoarseExactPValues')

snpm_test_config;
cd(spm_str_manip(which('snpm_test_config'), 'h'))
global testDataDir;
snpm_test_config;
if isempty(testDataDir)
error('test:emptytestDataDir', ...
['No test data directory specified, please fill in '...
' ''testDataDir'' variable in snpm_test_config.m'])
end
res_dir = fullfile(spm_file(testDataDir, 'path'), 'results');
if ~isdir(res_dir)
mkdir(res_dir)
end
cd(res_dir)

global SnPMrefVersion;
testCase.SnPMrefVersion = SnPMrefVersion;

Expand Down
13 changes: 13 additions & 0 deletions test/snpm_test_config.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
% Configuration file for computing ground truth tests.
%
% Update this file to specify your test data directory.
%
%_______________________________________________________________________
% Copyright (C) 2013-2016 The University of Warwick
% Id: snpm_test_config.m SnPM13 2013/10/12
% Camille Maumet

global testDataDir;
testDataDir = ''; % Specify directory containing test data
global SnPMrefVersion
SnPMrefVersion = 'SnPM8';
3 changes: 3 additions & 0 deletions test/snpm_tests.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import matlab.unittest.TestSuite;
suite = TestSuite.fromFolder(fullfile(spm_str_manip(which('snpm'), 'h'), 'test'));
result = run(suite)

0 comments on commit 09999a2

Please sign in to comment.