Skip to content

add tests, refactor and make sure output names are more bids compliant #19

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

Merged
merged 12 commits into from
Sep 1, 2021
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: miss_hit
name: miss_hit_quality

on:
push:
Expand Down Expand Up @@ -28,10 +28,8 @@ jobs:
run: |
python -m pip install --upgrade pip setuptools
pip3 install -r requirements.txt

- name: MISS_HIT Code style
run: |
mh_style --process-slx
cd tests
make data

- name: MISS_HIT Metrics
run: |
Expand Down
36 changes: 36 additions & 0 deletions .github/workflows/miss_hit_style.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: miss_hit_style

on:
push:
branches:
- master
pull_request:
branches: '*'

jobs:
build:

runs-on: ubuntu-latest

steps:

- uses: actions/checkout@v2
with:
submodules: true
fetch-depth: 1

- name: Set up Python 3.6
uses: actions/setup-python@v2
with:
python-version: 3.6

- name: Install dependencies
run: |
python -m pip install --upgrade pip setuptools
pip3 install -r requirements.txt
cd tests
make data

- name: MISS_HIT Code style
run: |
mh_style
25 changes: 12 additions & 13 deletions .github/workflows/run_tests.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
name: tests and coverage

# Uses the cron schedule for github actions
#
#
# https://docs.github.com/en/free-pro-team@latest/actions/reference/events-that-trigger-workflows#scheduled-events
#
#
# ┌───────────── minute (0 - 59)
# │ ┌───────────── hour (0 - 23)
# │ │ ┌───────────── day of the month (1 - 31)
# │ │ │ ┌───────────── month (1 - 12 or JAN-DEC)
# │ │ │ │ ┌───────────── day of the week (0 - 6 or SUN-SAT)
# │ │ │ │ │
# │ │ │ │ │
# │ │ │ │ │
# │ │ │ │ │
# * * * * *

on:
push:
branches:
- dev
- '*'
pull_request:
branches: '*'
schedule:
Expand All @@ -39,7 +39,7 @@ jobs:
sudo apt-get -y install octave liboctave-dev
sudo apt-get -y install nodejs npm

- name: Clone cpp_spm
- name: Clone cpp_spm
uses: actions/checkout@v2
with:
submodules: true
Expand All @@ -58,20 +58,19 @@ jobs:
git clone https://github.com/MOxUnit/MOxUnit.git --depth 1
make -C MOxUnit install
git clone https://github.com/MOcov/MOcov.git --depth 1
make -C MOcov install
make -C MOcov install

- name: Add bids-matlab
run: |
git clone https://github.com/bids-standard/bids-matlab.git --depth 1
run: |
git clone https://github.com/bids-standard/bids-matlab.git --depth 1

- name: Update octave path
run: |
octave $OCTFLAGS --eval "initCppRoi; savepath();"
octave $OCTFLAGS --eval "addpath(fullfile(pwd, 'bids-matlab')); savepath();"
octave $OCTFLAGS --eval "addpath(fullfile(pwd, 'bids-matlab')); savepath();"

- name: Run tests
run: |
octave $OCTFLAGS --eval "runTests"
octave $OCTFLAGS --eval "run_tests"
cat test_report.log | grep 0
bash <(curl -s https://codecov.io/bash)

bash <(curl -s https://codecov.io/bash)
7 changes: 3 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ envs/*
# visual studio code stuff
.vscode





demos/*/*.json
demos/*/*/*.json
demos/*/derivatives
36 changes: 36 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
repos:

- repo: local

hooks:

- id: mh_style
name: mh_style
entry: mh_style
args: [--process-slx, --fix]
files: ^(.*\.(m|slx))$
language: python
additional_dependencies: [miss_hit_core]

- id: mh_metric
name: mh_metric
entry: mh_metric
args: [--ci]
files: ^(.*\.(m|slx))$
language: python
additional_dependencies: [miss_hit_core]

- id: mh_lint
name: mh_lint
entry: mh_lint
files: ^(.*\.(m|slx))$
language: python
additional_dependencies: [miss_hit]

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.0.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
2 changes: 1 addition & 1 deletion .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ formats:
python:
version: 3.7
install:
- requirements: requirements.txt
- requirements: requirements.txt
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ TODO

- Can help generate ROI based on:
- the SPM Anatomy toolbox (INSERT URL)
- the SPM neuromorphometric atlas
- neurosynth probabilty maps
- the probabilistic maps of visual topography in human cortex:
- https://scholar.princeton.edu/napl/resources
Expand All @@ -98,6 +99,8 @@ Also includes:
- Yeo's 7 networks "atlas"
- add REF and URL



## Contributing

## Contributors
137 changes: 137 additions & 0 deletions atlas/space-IXI549Space_desc-neuromorphometrics_dseg.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
label,ROI
4,3rd Ventricle
11,4th Ventricle
23,Right Accumbens Area
30,Left Accumbens Area
31,Right Amygdala
32,Left Amygdala
35,Brain Stem
36,Right Caudate
37,Left Caudate
38,Right Cerebellum Exterior
39,Left Cerebellum Exterior
40,Right Cerebellum White Matter
41,Left Cerebellum White Matter
44,Right Cerebral White Matter
45,Left Cerebral White Matter
46,CSF
47,Right Hippocampus
48,Left Hippocampus
49,Right Inf Lat Vent
50,Left Inf Lat Vent
51,Right Lateral Ventricle
52,Left Lateral Ventricle
55,Right Pallidum
56,Left Pallidum
57,Right Putamen
58,Left Putamen
59,Right Thalamus Proper
60,Left Thalamus Proper
61,Right Ventral DC
62,Left Ventral DC
63,Right vessel
64,Left vessel
69,Optic Chiasm
71,Cerebellar Vermal Lobules I-V
72,Cerebellar Vermal Lobules VI-VII
73,Cerebellar Vermal Lobules VIII-X
75,Left Basal Forebrain
76,Right Basal Forebrain
100,Right ACgG anterior cingulate gyrus
101,Left ACgG anterior cingulate gyrus
102,Right AIns anterior insula
103,Left AIns anterior insula
104,Right AOrG anterior orbital gyrus
105,Left AOrG anterior orbital gyrus
106,Right AnG angular gyrus
107,Left AnG angular gyrus
108,Right Calc calcarine cortex
109,Left Calc calcarine cortex
112,Right CO central operculum
113,Left CO central operculum
114,Right Cun cuneus
115,Left Cun cuneus
116,Right Ent entorhinal area
117,Left Ent entorhinal area
118,Right FO frontal operculum
119,Left FO frontal operculum
120,Right FRP frontal pole
121,Left FRP frontal pole
122,Right FuG fusiform gyrus
123,Left FuG fusiform gyrus
124,Right GRe gyrus rectus
125,Left GRe gyrus rectus
128,Right IOG inferior occipital gyrus
129,Left IOG inferior occipital gyrus
132,Right ITG inferior temporal gyrus
133,Left ITG inferior temporal gyrus
134,Right LiG lingual gyrus
135,Left LiG lingual gyrus
136,Right LOrG lateral orbital gyrus
137,Left LOrG lateral orbital gyrus
138,Right MCgG middle cingulate gyrus
139,Left MCgG middle cingulate gyrus
140,Right MFC medial frontal cortex
141,Left MFC medial frontal cortex
142,Right MFG middle frontal gyrus
143,Left MFG middle frontal gyrus
144,Right MOG middle occipital gyrus
145,Left MOG middle occipital gyrus
146,Right MOrG medial orbital gyrus
147,Left MOrG medial orbital gyrus
148,Right MPoG postcentral gyrus medial segment
149,Left MPoG postcentral gyrus medial segment
150,Right MPrG precentral gyrus medial segment
151,Left MPrG precentral gyrus medial segment
152,Right MSFG superior frontal gyrus medial segment
153,Left MSFG superior frontal gyrus medial segment
154,Right MTG middle temporal gyrus
155,Left MTG middle temporal gyrus
156,Right OCP occipital pole
157,Left OCP occipital pole
160,Right OFuG occipital fusiform gyrus
161,Left OFuG occipital fusiform gyrus
162,Right OpIFG opercular part of the inferior frontal gyrus
163,Left OpIFG opercular part of the inferior frontal gyrus
164,Right OrIFG orbital part of the inferior frontal gyrus
165,Left OrIFG orbital part of the inferior frontal gyrus
166,Right PCgG posterior cingulate gyrus
167,Left PCgG posterior cingulate gyrus
168,Right PCu precuneus
169,Left PCu precuneus
170,Right PHG parahippocampal gyrus
171,Left PHG parahippocampal gyrus
172,Right PIns posterior insula
173,Left PIns posterior insula
174,Right PO parietal operculum
175,Left PO parietal operculum
176,Right PoG postcentral gyrus
177,Left PoG postcentral gyrus
178,Right POrG posterior orbital gyrus
179,Left POrG posterior orbital gyrus
180,Right PP planum polare
181,Left PP planum polare
182,Right PrG precentral gyrus
183,Left PrG precentral gyrus
184,Right PT planum temporale
185,Left PT planum temporale
186,Right SCA subcallosal area
187,Left SCA subcallosal area
190,Right SFG superior frontal gyrus
191,Left SFG superior frontal gyrus
192,Right SMC supplementary motor cortex
193,Left SMC supplementary motor cortex
194,Right SMG supramarginal gyrus
195,Left SMG supramarginal gyrus
196,Right SOG superior occipital gyrus
197,Left SOG superior occipital gyrus
198,Right SPL superior parietal lobule
199,Left SPL superior parietal lobule
200,Right STG superior temporal gyrus
201,Left STG superior temporal gyrus
202,Right TMP temporal pole
203,Left TMP temporal pole
204,Right TrIFG triangular part of the inferior frontal gyrus
205,Left TrIFG triangular part of the inferior frontal gyrus
206,Right TTG transverse temporal gyrus
207,Left TTG transverse temporal gyrus
4 changes: 3 additions & 1 deletion demos/atlas/create_roi_from_atlas.m
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
% (C) Copyright 2021 CPP ROI developers

opt.roi.atlas = 'wang';
opt.roi.name = {'V1v', 'V1d'};
opt.roi.dir = fullfile(pwd, 'derivatives', 'cpp_roi', 'group');

spm_mkdir(opt.roi.dir);

hemi = {'lh', 'rh'};
hemi = {'L', 'H'};

for iHemi = 1:numel(hemi)

Expand Down
26 changes: 26 additions & 0 deletions demos/roi/neurosynth_left_right_rois.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
% (C) Copyright 2021 CPP ROI developers

% small demo to show how to create and rename ROIs that come from neurosynth
% and how to only keep the data from one hemisphere of an image.

run ../../initCppRoi;

gunzip(fullfile('inputs', '*.gz'));
zMap = fullfile(pwd, 'inputs', 'visual motion_association-test_z_FDR_0.01.nii');

zMap = renameNeuroSynth(zMap);
roiImage = thresholdToMask(zMap, 5);

% keep only one hemisphere and appends a 'hs--[hemisphere label]'
leftRoiImage = keepHemisphere(roiImage, 'L');
rightRoiImage = keepHemisphere(roiImage, 'R');

% change the label entity and remove the hs one
leftRoiImage = renameFile(leftRoiImage, ...
struct('entities', struct( ...
'label', 'ns left motion', ...
'hemi', '')));
rightRoiImage = renameFile(rightRoiImage, ...
struct('entities', struct( ...
'label', 'ns right motion', ...
'hemi', '')));
21 changes: 0 additions & 21 deletions demos/roi/other_demo.m

This file was deleted.

Loading