Skip to content

Commit d06d6fb

Browse files
authored
Merge pull request #18 from cpp-lln-lab/dev
[REL] rc0.2.0
2 parents c3cd3a0 + e9fb9d2 commit d06d6fb

34 files changed

+1232
-412
lines changed

.github/workflows/run_tests.yml

Lines changed: 0 additions & 56 deletions
This file was deleted.
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: tests and coverage with matlab
2+
3+
on:
4+
5+
push:
6+
branches:
7+
- master
8+
- dev
9+
10+
pull_request:
11+
branches: ["*"]
12+
13+
jobs:
14+
15+
build:
16+
17+
runs-on: ubuntu-20.04
18+
19+
steps:
20+
21+
- name: Install MATLAB
22+
uses: matlab-actions/[email protected]
23+
with:
24+
# MATLAB release to set up R2020a
25+
release: R2020a
26+
27+
- name: Clone spm_2_bids
28+
uses: actions/checkout@v2
29+
with:
30+
submodules: true
31+
fetch-depth: 2
32+
33+
- name: Install Moxunit and MOcov
34+
run: |
35+
git clone https://github.com/MOxUnit/MOxUnit.git --depth 1
36+
git clone https://github.com/MOcov/MOcov.git --depth 1
37+
38+
- name: get bids-matlab and JSONio
39+
run: |
40+
make install_dev
41+
42+
- name: Run commands
43+
uses: matlab-actions/[email protected]
44+
with:
45+
command: cd(fullfile(getenv('GITHUB_WORKSPACE'), '.github', 'workflows')); run tests_matlab;
46+
47+
- name: Run tests
48+
run: |
49+
cat test_report.log | grep 0
50+
bash <(curl -s https://codecov.io/bash)
51+
52+
- name: Code coverage
53+
uses: codecov/codecov-action@v1
54+
with:
55+
file: coverage.xml # optional
56+
flags: unittests # optional
57+
name: codecov-umbrella # optional
58+
fail_ci_if_error: true # optional (default = false)

.github/workflows/tests_matlab.m

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
%
2+
% (C) Copyright 2022 spm_2_bids developers
3+
4+
root_dir = getenv('GITHUB_WORKSPACE');
5+
6+
disp(root_dir);
7+
ls(root_dir);
8+
9+
addpath(fullfile(root_dir, 'MOcov', 'MOcov'));
10+
11+
cd(fullfile(root_dir, 'MOxUnit', 'MOxUnit'));
12+
run moxunit_set_path();
13+
14+
cd(root_dir);
15+
init_spm_2_bids();
16+
17+
cd(root_dir);
18+
run run_tests();

.gitignore

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
*DS_Store
22

3-
*.m~
4-
*octave-workspace
3+
.vscode
4+
5+
*.json
56

67
env/
78

@@ -16,7 +17,6 @@ test_report.log
1617

1718
# From : https://github.com/github/gitignore/blob/master/Global/MATLAB.gitignore
1819

19-
2020
# Windows default autosave extension
2121
*.asv
2222

CITATION.cff

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
cff-version: 1.2.0
2+
3+
title: "spm_2_bids"
4+
5+
version: 0.2.0
6+
7+
abstract: Toolbox to convert SPM output files to valid BIDS derivatives.
8+
9+
message: "If you use this software, please cite it as below."
10+
11+
repository-code: "https://github.com/cpp-lln-lab/spm_2_bids.git"
12+
13+
contact:
14+
- affiliation: "Université catholique de Louvain"
15+
16+
family-names: Gau
17+
given-names: Rémi
18+
19+
authors:
20+
- family-names: "Gau"
21+
given-names: "Rémi"
22+
orcid: "https://orcid.org/0000-0002-1535-9767"
23+
affiliation: "Université catholique de Louvain"
24+
25+
license: GPL-3.0
26+
27+
keywords:
28+
- BIDS
29+
- brain imaging data structure
30+
- neuroimaging
31+
- converter
32+
- MRI
33+
- MATLAB
34+
- Octave
35+
- SPM

Makefile

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,30 @@
1-
install_dev:
2-
git clone https://github.com/bids-standard/bids-matlab.git lib/bids-matlab
3-
cd lib/bids-matlab && git checkout dev
4-
git clone https://github.com/gllmflndn/JSONio.git --depth 1 lib/JSONio
1+
.PHONY: clean
52

6-
install_dev_octave:
7-
git clone https://github.com/bids-standard/bids-matlab.git lib/bids-matlab
8-
cd lib/bids-matlab && git checkout dev
9-
git clone https://github.com/gllmflndn/JSONio.git --depth 1 lib/JSONio
3+
install_dev_octave: install_dev
104
cd lib/JSONio && mkoctfile --mex jsonread.c jsmn.c -DJSMN_PARENT_LINKS
5+
install_dev: lib/bids-matlab lib/JSONio
6+
7+
lib/bids-matlab:
8+
git clone https://github.com/bids-standard/bids-matlab.git --branch dev lib/bids-matlab
119

12-
clean:
10+
lib/JSONio:
11+
git clone https://github.com/gllmflndn/JSONio.git --depth 1 lib/JSONio
12+
clean: clean_doc clean_tests
1313
rm -rf lib/bids-matlab
1414
rm -rf lib/JSONio
15+
rm -rf version.txt
16+
17+
clean_doc:
18+
cd docs && make clean
19+
20+
21+
clean_tests:
22+
rm -rf coverage_html
23+
rm -f coverage.xml
24+
rm -f *.log
25+
26+
version.txt: CITATION.cff
27+
grep -w "^version" CITATION.cff | sed "s/version: /v/g" > version.txt
28+
29+
validate_cff: CITATION.cff
30+
cffconvert --validate

README.md

Lines changed: 34 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,47 @@
1-
<!--
1+
[![code quality](https://github.com/cpp-lln-lab/spm_2_bids/actions/workflows/miss_hit_code_quality.yml/badge.svg)](https://github.com/cpp-lln-lab/spm_2_bids/actions/workflows/miss_hit_code_quality.yml)
2+
[![code style](https://github.com/cpp-lln-lab/spm_2_bids/actions/workflows/miss_hit_code_style.yml/badge.svg)](https://github.com/cpp-lln-lab/spm_2_bids/actions/workflows/miss_hit_code_style.yml)
3+
[![tests](https://github.com/cpp-lln-lab/spm_2_bids/actions/workflows/run_tests.yml/badge.svg)](https://github.com/cpp-lln-lab/spm_2_bids/actions/workflows/run_tests.yml)
4+
[![codecov](https://codecov.io/gh/cpp-lln-lab/spm_2_bids/branch/master/graph/badge.svg?token=yaL40GJK9y)](https://codecov.io/gh/cpp-lln-lab/spm_2_bids)
25

3-
When you have set up your repo
6+
# spm_2_bids
47

5-
**Unit tests and coverage**
8+
Small code base to help convert the MRI spm output to a valid bids derivatives.
69

7-
[![](https://img.shields.io/badge/Octave-CI-blue?logo=Octave&logoColor=white)](https://github.com/Remi-gau/template_matlab_analysis/actions)
8-
![](https://github.com/Remi-gau/template_matlab_analysis/workflows/CI/badge.svg)
10+
This code only generates the plausible BIDS derivatives filename for given file
11+
that has been preprocessed with SPM.
912

10-
[![codecov](https://codecov.io/gh/Remi-gau/template_matlab_analysis/branch/master/graph/badge.svg)](https://codecov.io/gh/Remi-gau/template_matlab_analysis)
13+
Most of the renaming is based on the SPM prefixes combinations.
1114

12-
**Miss_hit linter**
15+
It is configurable to adapt to new set of prefixes.
1316

14-
[![Build Status](https://travis-ci.com/Remi-gau/template_matlab_analysis.svg?branch=master)](https://travis-ci.com/Remi-gau/template_matlab_analysis)
17+
## Dependencies
1518

16-
-->
19+
- [BIDS-matlab](https://github.com/bids-standard/bids-matlab)
1720

18-
# spm_2_bids
21+
Can be installed with :
1922

20-
Small code base to help convert the MRI spm output to a valid bids derivatives.
23+
For MATLAB
2124

22-
This code only generates the plausible BIDS derivatives filename for given file that has
23-
been preprocessed with SPM.
25+
```bash
26+
make install_dev
27+
```
2428

25-
Most of the renaming is based on the SPM prefixes combinations.
29+
For Octave
2630

27-
It is configurable to adapt to new set of prefixes.
31+
```bash
32+
make install_dev_octave
33+
```
34+
35+
## Usage
36+
37+
```matlab
38+
file = 'wmsub-01_desc-skullstripped_T1w.nii';
39+
40+
[new_filename, pth, json] = spm_2_bids(file);
41+
42+
new_filename =
43+
44+
'sub-01_space-IXI549Space_desc-preproc_T1w.nii');
45+
```
2846

29-
- [Dependencies](./lib/README.md)
30-
- [Documentation](https://spm-2-bids.readthedocs.io/en/latest/)
47+
For more see the [documentation](https://spm-2-bids.readthedocs.io/en/latest/).

docs/Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,6 @@ help:
1818
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
1919
%: Makefile
2020
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
21+
22+
clean:
23+
rm -rf build

docs/requirements.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1+
# doc
12
Sphinx
23
sphinxcontrib-matlabdomain
3-
sphinxcontrib-napoleon
4+
sphinx-copybutton
45
sphinx_rtd_theme
6+
rstcheck
7+
myst-parser

0 commit comments

Comments
 (0)