Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
7 changes: 6 additions & 1 deletion .github/workflows/matlab_workflow_script.m
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,12 @@
cd(fullfile(root_dir, 'MOxUnit', 'MOxUnit'));
run moxunit_set_path();

cd(fullfile(root_dir));
cd(root_dir);
initCppSpm();
addpath(fullfile(root_dir, 'tests', 'utils'));

cd demos/MoAE;
download_moae_ds(true);

cd(root_dir);
run run_tests();
13 changes: 4 additions & 9 deletions .github/workflows/run_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,19 +63,14 @@ jobs:

- name: Update octave path
run: |
octave $OCTFLAGS --eval "initCppSpm; savepath();"
octave $OCTFLAGS --eval "addpath(fullfile(pwd, 'tests', 'utils')); savepath();"
octave $OCTFLAGS --eval "initCppSpm; savepath(); exit;"
octave $OCTFLAGS --eval "addpath(fullfile(pwd, 'tests', 'utils')); savepath(); exit;"

- name: Prepare data
run: |
inputs_folder='demos/MoAE/inputs/'
mkdir $inputs_folder
curl http://www.fil.ion.ucl.ac.uk/spm/download/data/MoAEpilot/MoAEpilot.bids.zip --output $inputs_folder'MoAEpilot.zip'
unzip $inputs_folder'MoAEpilot.zip' -d $inputs_folder
mv $inputs_folder/MoAEpilot $inputs_folder/raw
octave $OCTFLAGS --eval "initCppSpm; cd demos/MoAE; download_moae_ds(true); exit;"
cd tests
sh createDummyDataSet.sh
cd ..
make data

- name: Run tests
run: |
Expand Down
5 changes: 0 additions & 5 deletions .github/workflows/run_tests_matlab.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,6 @@ jobs:

- name: Prepare data
run: |
inputs_folder='demos/MoAE/inputs/'
mkdir $inputs_folder
curl http://www.fil.ion.ucl.ac.uk/spm/download/data/MoAEpilot/MoAEpilot.bids.zip --output $inputs_folder'MoAEpilot.zip'
unzip $inputs_folder'MoAEpilot.zip' -d $inputs_folder
mv $inputs_folder/MoAEpilot $inputs_folder/raw
cd tests
make data

Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/update_submodules.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ name: update submodules
on:
push:
branches:
- main
- master
- dev
schedule:
- cron: "0 0 1 * *"
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ venv/*
## visual studio code
.vscode

cfg
group

## MATLAB / OCTAVE gitignore template

# From : https://github.com/github/gitignore/blob/master/Global/MATLAB.gitignore
Expand Down
65 changes: 65 additions & 0 deletions demos/MoAE/download.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
function filename = download(URL, output_dir, verbose)
%
% USAGE::
%
% filename = download(URL, output_dir, verbose)
%
% (C) Copyright 2021 Remi Gau
if nargin < 2
output_dir = pwd;
end

msg = sprintf('Downloading dataset from:\n %s\n\n', URL);
print_to_screen(msg, verbose);

tokens = regexp(URL, '/', 'split');
protocol = tokens{1};

filename = tokens{end};

if exist(filename, 'file')
delete(filename);
end

if strcmp(protocol, 'http:')

if isunix()
if verbose
system(sprintf('wget %s', URL));
else
system(sprintf('wget -q %s', URL));
end
else
urlwrite(URL, filename);
end

% move file in case it was not downloaded in the root dir
if ~exist(fullfile(output_dir, filename), 'file')
print_to_screen([filename ' --> ' output_dir], verbose);
movefile(filename, fullfile(output_dir, filename));
end
filename = fullfile(output_dir, filename);

else

ftp_server = tokens{3};
ftpobj = ftp(ftp_server);

filename = strjoin(tokens(4:end), '/');
filename = mget(ftpobj, filename, output_dir);

end

if iscell(filename)
filename = filename{1};
end

print_to_screen(' Done\n\n', verbose);

end

function print_to_screen(msg, verbose)
if verbose
fprintf(1, msg);
end
end
15 changes: 10 additions & 5 deletions demos/MoAE/download_moae_ds.m
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,18 @@ function download_moae_ds(downloadData)
spm_mkdir(fullfile(working_directory, 'inputs'));

%% Get data
fprintf('%-10s:', 'Downloading dataset...');
urlwrite(URL, 'MoAEpilot.zip');
fprintf(1, ' Done\n\n');
filename = download(URL, fullfile(working_directory, 'inputs'), true);

fprintf('%-10s:', 'Unzipping dataset...');
unzip('MoAEpilot.zip');
movefile('MoAEpilot', fullfile(working_directory, 'inputs', 'raw'));
unzip(filename);
if isOctave()
movefile(fullfile(working_directory, 'inputs', 'MoAEpilot'), ...
fullfile(working_directory, 'inputs', 'raw'));
delete(filename);
else
movefile('MoAEpilot', fullfile(working_directory, 'inputs', 'raw'));
delete(filename);
end
fprintf(1, ' Done\n\n');

end
Expand Down
3 changes: 2 additions & 1 deletion tests/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@
*/*.json
group/*
dummyData/derivatives/cpp_spm*/sub-*/
dummyData/copy/
dummyData/copy/
bids-examples
1 change: 1 addition & 0 deletions tests/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ data:
rm -f bids-examples/.gitkeep
git clone https://github.com/bids-standard/bids-examples.git --depth 1
cp bids-examples/synthetic/dataset_description.json bids-examples/synthetic/derivatives/fmriprep
touch bids-examples/.gitkeep

clean_openneuro:
rm -rf openneuro/*
Expand Down
Empty file added tests/bids-examples/.gitkeep
Empty file.
2 changes: 2 additions & 0 deletions tests/miss_hit.cfg
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
regex_function_name: "(test(_unit){0,1}_[a-z]+|[a-z]+)(([A-Z]){1}[A-Za-z0-9]+)*"

exclude_dir: "bids-examples"