diff --git a/README.md b/README.md index 15b6ca1..82c26fd 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/README.txt b/README.txt index 8b1ca50..d4bf341 100644 --- a/README.txt +++ b/README.txt @@ -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 diff --git a/config/snpm_bch_ui_ANOVAbtwnS.m b/config/snpm_bch_ui_ANOVAbtwnS.m index 362aadd..8748e03 100644 --- a/config/snpm_bch_ui_ANOVAbtwnS.m +++ b/config/snpm_bch_ui_ANOVAbtwnS.m @@ -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.'}; diff --git a/snpm.m b/snpm.m index 2195f31..85d6666 100644 --- a/snpm.m +++ b/snpm.m @@ -49,7 +49,7 @@ %-Parameters %----------------------------------------------------------------------- -SnPMver = 'SnPM13.1.05'; +SnPMver = 'SnPM13.1.06'; %-Format arguments %----------------------------------------------------------------------- @@ -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 diff --git a/snpm_STcalc.m b/snpm_STcalc.m index c05e828..42b372c 100644 --- a/snpm_STcalc.m +++ b/snpm_STcalc.m @@ -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); diff --git a/test/common/generic_test_snpm.m b/test/common/generic_test_snpm.m index 19e0797..4b213bb 100644 --- a/test/common/generic_test_snpm.m +++ b/test/common/generic_test_snpm.m @@ -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; diff --git a/test/snpm_test_config.m b/test/snpm_test_config.m new file mode 100644 index 0000000..0f781d2 --- /dev/null +++ b/test/snpm_test_config.m @@ -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'; \ No newline at end of file diff --git a/test/snpm_tests.m b/test/snpm_tests.m new file mode 100644 index 0000000..04232ce --- /dev/null +++ b/test/snpm_tests.m @@ -0,0 +1,3 @@ +import matlab.unittest.TestSuite; +suite = TestSuite.fromFolder(fullfile(spm_str_manip(which('snpm'), 'h'), 'test')); +result = run(suite) \ No newline at end of file