Skip to content

Commit 09999a2

Browse files
author
Camille Maumet
authored
Merge pull request #27 from nicholst/SnPM13.1.06
SnPM 13.1.06 including #25 and #26
2 parents f254ffc + 87c838a commit 09999a2

File tree

8 files changed

+51
-11
lines changed

8 files changed

+51
-11
lines changed

README.md

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,16 @@ The SnPM toolbox provides an alternative to the Statistics section of [SPM](http
1515
### Testing
1616

1717
#### Initial set up
18-
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:
18+
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:
1919
```
2020
global testDataDir;
2121
testDataDir = '~/snpm_test_data';
22-
global SnPMrefVersion;
23-
SnPMrefVersion = 'SnPM8';
2422
```
2523

2624
#### Run the test suite
27-
Then, the tests can be started (from the test data folder) with:
25+
Then, the tests can be started with:
2826
```
29-
import matlab.unittest.TestSuite;
30-
suite = TestSuite.fromFolder(fullfile(spm_str_manip(which('snpm'), 'h'), 'test'));
31-
result = run(suite);
27+
snpm_tests
3228
```
3329

3430
#### Run a single test

README.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ This file describes the bugs that have been reported, along with the appropriate
44
Updated versions of appropriate SnPM functions are available from in the snpm13_updates:
55
http://warwick.ac.uk/snpm/distribution/snpm13_updates
66

7+
--- SnPM 13.1.06 ---
8+
* fix: ANOVA between group "all zero"/"all equal" options were flipped in the menu of the matlabbatch.
9+
* fix: snpm_cp can now handle XYZ locations in a 1D space.
10+
* Version 13.1.06 (`snpm`)
11+
712
--- SnPM 13.1.05 ---
813
* 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`)
914
* fix: warning on size of `SnPM_ST.mat` was never raised

config/snpm_bch_ui_ANOVAbtwnS.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
nullHypAllZero.tag = 'nullHypAllZero';
6565
nullHypAllZero.name = 'Null Hypothesis';
6666
nullHypAllZero.labels = {'Groups are all equal' 'Groups are all zero'};
67-
nullHypAllZero.values = {true false};
67+
nullHypAllZero.values = {false true};
6868
nullHypAllZero.help = {'','Null Hypothesis: Groups are all zero|all equal.'};
6969

7070

snpm.m

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949

5050
%-Parameters
5151
%-----------------------------------------------------------------------
52-
SnPMver = 'SnPM13.1.05';
52+
SnPMver = 'SnPM13.1.06';
5353

5454
%-Format arguments
5555
%-----------------------------------------------------------------------
@@ -65,6 +65,11 @@
6565
else
6666
clc
6767
end
68+
% Add test code to Matlabpath
69+
if ~exist('test_oneSample', 'file')
70+
addpath(fullfile(spm_file(which('snpm'), 'path'), 'test'));
71+
addpath(fullfile(spm_file(which('snpm'), 'path'), 'test', 'common'));
72+
end
6873
snpm_defaults;
6974
[Finter,Fgraph,CmdLine] = spm('FnUIsetup','Statistical non-Parametric Mapping (SnPM)');
7075
snpm_init; % Initialize Matlab Batch system

snpm_STcalc.m

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,14 @@
126126
end
127127

128128
[N,Z,M,A] = spm_max(ST,XYZ);
129+
130+
% Enfore A to be a column vector. When XYZ locations are defined in a 1D
131+
% space, spm_max returns A as a row vector instead of a column which
132+
% makes find(A==i) fails later in the code below.
133+
if size(A,2) > 1
134+
A = A';
135+
end
136+
129137
Aindex = spm_clusters(XYZ); %- cluster indexes
130138

131139
STCS = snpm_STcalc('initK',STCS,max(A),isPos,perm);

test/common/generic_test_snpm.m

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,19 @@ function setGlobals(testCase)
4747
% Disable warning on very small number of permutations
4848
warning('off','SnPM:VeryFewPermsCoarseExactPValues')
4949

50-
snpm_test_config;
51-
cd(spm_str_manip(which('snpm_test_config'), 'h'))
5250
global testDataDir;
51+
snpm_test_config;
52+
if isempty(testDataDir)
53+
error('test:emptytestDataDir', ...
54+
['No test data directory specified, please fill in '...
55+
' ''testDataDir'' variable in snpm_test_config.m'])
56+
end
57+
res_dir = fullfile(spm_file(testDataDir, 'path'), 'results');
58+
if ~isdir(res_dir)
59+
mkdir(res_dir)
60+
end
61+
cd(res_dir)
62+
5363
global SnPMrefVersion;
5464
testCase.SnPMrefVersion = SnPMrefVersion;
5565

test/snpm_test_config.m

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
% Configuration file for computing ground truth tests.
2+
%
3+
% Update this file to specify your test data directory.
4+
%
5+
%_______________________________________________________________________
6+
% Copyright (C) 2013-2016 The University of Warwick
7+
% Id: snpm_test_config.m SnPM13 2013/10/12
8+
% Camille Maumet
9+
10+
global testDataDir;
11+
testDataDir = ''; % Specify directory containing test data
12+
global SnPMrefVersion
13+
SnPMrefVersion = 'SnPM8';

test/snpm_tests.m

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import matlab.unittest.TestSuite;
2+
suite = TestSuite.fromFolder(fullfile(spm_str_manip(which('snpm'), 'h'), 'test'));
3+
result = run(suite)

0 commit comments

Comments
 (0)