From 36ca02929d1256199fe95d3a841dcf9948bf7b75 Mon Sep 17 00:00:00 2001 From: cmaumet Date: Wed, 31 Aug 2016 10:38:07 +0100 Subject: [PATCH 01/10] fix: 'Error using ==. Matrix dimensions must agree' when locations are in a 1D space. --- snpm_STcalc.m | 8 ++++++++ 1 file changed, 8 insertions(+) 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); From 6dbc714bc49c0b4bf6c284854a38aaeddaaf6caf Mon Sep 17 00:00:00 2001 From: nicholst Date: Thu, 6 Oct 2016 13:48:02 +0100 Subject: [PATCH 02/10] Fixed bug where "all equal" and "all zero" are flipped. --- config/snpm_bch_ui_ANOVAbtwnS.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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.'}; From ca7c2bd13edcf076008e86f1059bb88b323e327f Mon Sep 17 00:00:00 2001 From: cmaumet Date: Tue, 18 Oct 2016 07:56:30 +0100 Subject: [PATCH 03/10] Add test and test/commons to path at startup Fixes #17 --- snpm.m | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/snpm.m b/snpm.m index 2195f31..43547ba 100644 --- a/snpm.m +++ b/snpm.m @@ -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 From 7fec19e1170e5ed32c69c145fe2178a9842e6232 Mon Sep 17 00:00:00 2001 From: cmaumet Date: Tue, 18 Oct 2016 08:02:34 +0100 Subject: [PATCH 04/10] Script to run all tests --- test/snpm_tests.m | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 test/snpm_tests.m diff --git a/test/snpm_tests.m b/test/snpm_tests.m new file mode 100644 index 0000000..60f3306 --- /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 From 14b46dc3f42213d94af10e9eefe70d575239f8a6 Mon Sep 17 00:00:00 2001 From: cmaumet Date: Tue, 18 Oct 2016 08:02:53 +0100 Subject: [PATCH 05/10] Example of empty test config file --- test/snpm_test_config.m | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 test/snpm_test_config.m 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 From 7ad4397921fae04a8ed428aec31c499bacb7a815 Mon Sep 17 00:00:00 2001 From: cmaumet Date: Tue, 18 Oct 2016 08:09:25 +0100 Subject: [PATCH 06/10] Check if test data folder has been specified --- test/common/generic_test_snpm.m | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) 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; From 21af41b86362796131748084436c2687ef22563f Mon Sep 17 00:00:00 2001 From: cmaumet Date: Tue, 18 Oct 2016 08:14:58 +0100 Subject: [PATCH 07/10] Update README for testing --- README.md | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) 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 From 27ee7af4ff67666a8f08a39e9aecc88316dbb01d Mon Sep 17 00:00:00 2001 From: cmaumet Date: Tue, 18 Oct 2016 09:00:33 +0100 Subject: [PATCH 08/10] Display test results --- test/snpm_tests.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/snpm_tests.m b/test/snpm_tests.m index 60f3306..04232ce 100644 --- a/test/snpm_tests.m +++ b/test/snpm_tests.m @@ -1,3 +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 +result = run(suite) \ No newline at end of file From 6dbec13f9c530b732ccd83117b23967424007482 Mon Sep 17 00:00:00 2001 From: cmaumet Date: Tue, 18 Oct 2016 09:04:43 +0100 Subject: [PATCH 09/10] SnPM13.1.06 --- snpm.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/snpm.m b/snpm.m index 43547ba..85d6666 100644 --- a/snpm.m +++ b/snpm.m @@ -49,7 +49,7 @@ %-Parameters %----------------------------------------------------------------------- -SnPMver = 'SnPM13.1.05'; +SnPMver = 'SnPM13.1.06'; %-Format arguments %----------------------------------------------------------------------- From 87c838ab25d015beabfe9ca05f37d4528dbcacd3 Mon Sep 17 00:00:00 2001 From: cmaumet Date: Tue, 18 Oct 2016 09:17:38 +0100 Subject: [PATCH 10/10] Updated release README --- README.txt | 5 +++++ 1 file changed, 5 insertions(+) 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