Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Travis testing #37

Merged
merged 59 commits into from
May 28, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
8cb32cf
tricking travis
TomMaullin Apr 25, 2018
4094e73
Travis file changed
TomMaullin Apr 25, 2018
1a80a41
attempt to make docker snapshot work
TomMaullin Apr 25, 2018
af47839
Update .travis.yml
TomMaullin Apr 27, 2018
7eac845
Update .travis.yml
TomMaullin Apr 30, 2018
4ec7f4f
Update .travis.yml
TomMaullin Apr 30, 2018
97971d4
Update .travis.yml
TomMaullin Apr 30, 2018
285e1ca
Mounted test folder
TomMaullin Apr 30, 2018
4afd578
Update .travis.yml
TomMaullin Apr 30, 2018
a277c05
wip
TomMaullin May 4, 2018
fb117ae
added octave versions of tests
TomMaullin May 4, 2018
45810d5
syntax error removed
TomMaullin May 4, 2018
2f12b7b
name changes
TomMaullin May 4, 2018
f6e0495
headers
TomMaullin May 4, 2018
e4999aa
check->test
TomMaullin May 4, 2018
421bf04
removed matlab
TomMaullin May 4, 2018
1848a54
websave->urlwrite
TomMaullin May 4, 2018
fc28e27
websave->urlwrite
TomMaullin May 4, 2018
a11f051
Octave fixes
TomMaullin May 4, 2018
afc25f6
temporary contains fix
TomMaullin May 4, 2018
419ea7a
wip travis tests
TomMaullin May 22, 2018
d68ed81
Travis tests partially working
TomMaullin May 22, 2018
0d85f3e
travis tests now work... almost
TomMaullin May 22, 2018
da19cf2
unzip data
TomMaullin May 22, 2018
6bc357f
mv file changed
TomMaullin May 22, 2018
5b8cd7a
doublechecking paths
TomMaullin May 22, 2018
bdd4646
doublechecking paths
TomMaullin May 22, 2018
cff1772
hopefully tests should now run
TomMaullin May 22, 2018
9c001ef
outputting results
TomMaullin May 22, 2018
e4414d0
hopefully edited bash script to communicate with Travis
TomMaullin May 22, 2018
227be0b
Update runTest.sh
TomMaullin May 22, 2018
df964f6
Update runTest.sh
TomMaullin May 22, 2018
5291e65
Update runTest.sh
TomMaullin May 22, 2018
61da107
Update runTest.sh
TomMaullin May 22, 2018
760220c
wip cleaning up tests
TomMaullin May 23, 2018
6270a6f
wip cleaning up tests
TomMaullin May 23, 2018
96ad489
wip cleaning up tests
TomMaullin May 23, 2018
9b4e1ec
hopefully fixed last test
TomMaullin May 23, 2018
0b88000
removed now redundant files
TomMaullin May 23, 2018
6d70276
hopefully fixed last test
TomMaullin May 23, 2018
be9daa7
Trigering travis
cmaumet May 23, 2018
a113f56
Re-Trigering travis
cmaumet May 23, 2018
4fd1342
Patch updates
TomMaullin May 23, 2018
74f6b9c
Merge branch 'TravisTesting' of https://github.com/tommaullin/nidmres…
TomMaullin May 23, 2018
a425199
small attempt at removing patch warning
TomMaullin May 23, 2018
02338e4
using SPM functions instead of octave statistics
TomMaullin May 23, 2018
f485819
removal of octave-statistics
TomMaullin May 23, 2018
84e06a0
removal of patch warning #2
TomMaullin May 23, 2018
24bb137
Update .gitignore
TomMaullin May 23, 2018
942d2f7
moved into moxunit folder
TomMaullin May 25, 2018
37e9aea
small merge conflict
TomMaullin May 25, 2018
8c562bf
small directory fix
TomMaullin May 25, 2018
f7ab256
wrong testFeatures
TomMaullin May 25, 2018
779baff
paths ammended
TomMaullin May 25, 2018
869011d
readded testdata
TomMaullin May 25, 2018
ee1d8ae
both testing suites now there
TomMaullin May 25, 2018
1c46776
Update README.md
TomMaullin May 25, 2018
c9bf0ee
Update README.md
TomMaullin May 25, 2018
288beaa
Update README.md
TomMaullin May 25, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@
# images in data folder
Data/*.png

# Test data (if missing will be downloaded from NeuroVault)
# Test data
test/data
test/moxunit_testsuite/MOxUnit

#nii files
*.nii
Expand All @@ -30,4 +31,4 @@ test/data
#ZIP files
*.zip

_ignored*
_ignored*
40 changes: 40 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
language: python
# use container-based infrastructure
sudo: required
services:
- docker
cache:
pip: true
timeout: 1000
python:
- "3.5"
bundler_args: --retry 9
# command to install dependencies, e.g. pip install -r requirements.txt --use-mirrors
install:
- pip install --upgrade setuptools
- cd test/moxunit_testsuite
# Download MoxUnit for unit testing
- git clone https://github.com/MOxUnit/MOxUnit.git
- ls
- cd ..
# Download data
- cd data
- wget https://neurovault.org/collections/2210/download
- unzip download
- mv NIDM-Results\ 1.3.0\ examples\ -\ nidmfsl\ 1.2.01\ and\ SPM12\ r6906/* .
- rm -r NIDM-Results\ 1.3.0\ examples\ -\ nidmfsl\ 1.2.01\ and\ SPM12\ r6906/
- cd ../..
- ls
script:
# Run docker snapshot of dev octave (until 4.4 is released)
- did=$(sudo docker run -ti -d --rm -v `pwd`:/spmviewer cmaumet/octave-spm)
# Run tests in Octave
- sudo docker exec -t -i $did bash -c "sudo chmod 755 /spmviewer/test/moxunit_testsuite/runTest.sh; sudo /spmviewer/test/moxunit_testsuite/runTest.sh"
before_install:
# Update docker version
- sudo apt-get update
- sudo apt-get -y -o Dpkg::Options::="--force-confnew" install docker-ce
- git config --global user.name "TravisCI"
- git config --global user.email "travis@dummy.com"
- sudo docker pull cmaumet/octave-spm

44 changes: 36 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@

Read and display NIDM-Results packs in the SPM environment.

##### Usage

#### Usage
To view NIDM results using the NIDM results viewer run the following

1. Open `SPM fMRI` from the Matlab command line.
Expand Down Expand Up @@ -33,11 +32,11 @@ To view NIDM results using the NIDM results viewer run the following
:-------------------------:|:-------------------------:
**Fig. 5.** Table data and images | **Fig. 6.** Summary statistics

##### Requirements
#### Requirements

- [SPM12](http://www.fil.ion.ucl.ac.uk/spm/software/spm12/)

##### Installation
#### Installation

1. Add the filepath to SPM in Matlab;

Expand All @@ -49,15 +48,44 @@ To view NIDM results using the NIDM results viewer run the following
<full path to SPM>/toolbox/
```

##### Testing
#### Testing

Currently, two versions of the test suite exist. One is based on the `matlab unittesting framework` and the other is based on the [`MOxUnit`](https://github.com/MOxUnit/MOxUnit) library.

The `matlab unittesting framework` tests are recommended for testing the code locally in `Matlab` as they perform much faster and do not require any additional installation. The `MOxUnit` tests are recommended for testing the code locally in `Octave` and are also used for the Travis CI. Below is a description of how to run each test set.

##### Matlab Unittesting Framework

1. Add the filepath to the 'tests' folder;
1. Add the filepath to the 'tests/matlabunit_testsuite' folder. In the Matlab commandline type;

```
addpath(fullfile(fileparts(which('nidm_results_display')), 'test'))
addpath(fullfile(fileparts(which('nidm_results_display')), 'test', 'matlabunit_testsuite'))
```
2. Run runTest;
2. Run runTest. In the Matlab commandline type;

```
runTest();
```

##### MOxUnit Framework

1. Download the MOxUnit testing framework to 'tests/moxunit_testsuite'. In the bash commandline type;

```
cd <PATH-TO-REPOSITORY>/tests/moxunit_testsuite
git clone https://github.com/MOxUnit/MOxUnit.git
```
2. Download the test data from [NeuroVault](https://neurovault.org/). In the bash commandline type;

```
cd <PATH-TO-REPOSITORY>/tests/data
wget https://neurovault.org/collections/2210/download
unzip download
mv NIDM-Results\ 1.3.0\ examples\ -\ nidmfsl\ 1.2.01\ and\ SPM12\ r6906/* .
rm -r NIDM-Results\ 1.3.0\ examples\ -\ nidmfsl\ 1.2.01\ and\ SPM12\ r6906/
```
3. From 'tests/moxunit_testsuite' run the MOxUnit tests. In the Octave/Matlab terminal type;

```
moxunit_runtests
```
6 changes: 3 additions & 3 deletions lib/changeNIDMtoTabDat.m
Original file line number Diff line number Diff line change
Expand Up @@ -489,11 +489,11 @@
else
%Calculate whichever statistic type is used.
if strcmp(statType, 'T')
tableTemp{n, 9} = icdf('T',1-tableTemp{n, 11},errorDegrees);
tableTemp{n, 9} = spm_invTcdf(1-tableTemp{n, 11},errorDegrees);
elseif strcmp(statType, 'X')
tableTemp{n, 9} = icdf('Chi',1-tableTemp{n, 11},errorDegrees);
tableTemp{n, 9} = spm_invXcdf(1-tableTemp{n, 11},errorDegrees);
elseif strcmp(statType, 'F')
tableTemp{n, 9} = icdf('F',1-tableTemp{n, 11},effectDegrees, errorDegrees);
tableTemp{n, 9} = spm_invFcdf(1-tableTemp{n, 11},effectDegrees, errorDegrees);
else
tableTemp{n, 9} = '';
end
Expand Down
6 changes: 6 additions & 0 deletions lib/generateMIP.m
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,11 @@ function generateMIP(filepath, filename, DIM, units)
%Write the image:
mipPath = spm_file(fullfile(filepath, 'MIP.png'));
imwrite(mip,gray(64),mipPath,'png');

%In some versions of octave/matlab the above removes
%the original .nii.gz file.
if ~exist(fullfile(filepath, filename), 'file')
gzip(strrep(fullfile(filepath, filename), '.gz', ''));
end

end
8 changes: 4 additions & 4 deletions test/runTest.m → test/matlabunit_testsuite/runTest.m
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@

function runTest()

%Clear previous classes (and keep debugging breakpoints)
clear classes;
%Clear previous classes.
clear all;

%Setup steps for the test.
import matlab.unittest.TestSuite;
addpath(fullfile(fileparts(mfilename('fullpath')),'..', 'lib'));
addpath(fullfile(fileparts(mfilename('fullpath')),'..'));
addpath(fullfile(fileparts(mfilename('fullpath')),'..', '..', 'lib'));
addpath(fullfile(fileparts(mfilename('fullpath')),'..', '..'));

%Run all tests.
tests = [matlab.unittest.TestSuite.fromFile(which('testDataSets')),...
Expand Down
Loading