Skip to content

Commit 22915ce

Browse files
authored
Merge branch 'dev' into dev
2 parents b81c7e3 + 89d6e63 commit 22915ce

34 files changed

+516
-129
lines changed

.github/workflows/miss_hit_quality.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77
- master
88
- dev
99
pull_request:
10-
branches: '*'
10+
branches: ['*']
1111

1212
jobs:
1313
build:
@@ -30,8 +30,6 @@ jobs:
3030
run: |
3131
python -m pip install --upgrade pip setuptools
3232
pip3 install -r requirements.txt
33-
cd tests
34-
make data
3533
3634
- name: MISS_HIT Metrics
3735
run: |

.github/workflows/miss_hit_style.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77
- master
88
- dev
99
pull_request:
10-
branches: '*'
10+
branches: ['*']
1111

1212
jobs:
1313
build:
@@ -30,8 +30,6 @@ jobs:
3030
run: |
3131
python -m pip install --upgrade pip setuptools
3232
pip3 install -r requirements.txt
33-
cd tests
34-
make data
3533
3634
- name: MISS_HIT Code style
3735
run: |

.github/workflows/run_tests.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@ name: tests and coverage
1717
on:
1818
push:
1919
branches:
20+
- dev
2021
- main
2122
- master
22-
- dev
2323
pull_request:
24-
branches: '*'
24+
branches: ['*']
2525
schedule:
26-
- cron: "0 0 1 * *"
26+
- cron: "1 1 1 * *"
2727

2828
env:
2929
OCTFLAGS: --no-gui --no-window-system --silent

.gitignore

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
1-
21
.DS_Store
32

43
*.nii
5-
4+
*.xml
5+
*.log
66
*.asv
77
*.m~
88
*.mat
99

10+
*.html
11+
12+
# files in the demo folder related to running the demo analysis
13+
# demos/roi
14+
1015
atlas/visual_topography_probability_atlas/
1116

1217
# test folder and dummy data
@@ -23,3 +28,5 @@ envs/*
2328
demos/*/*.json
2429
demos/*/*/*.json
2530
demos/*/derivatives
31+
32+
atlas/*.json

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ repos:
2828
additional_dependencies: [miss_hit]
2929

3030
- repo: https://github.com/pre-commit/pre-commit-hooks
31-
rev: v4.0.1
31+
rev: v4.1.0
3232
hooks:
3333
- id: trailing-whitespace
3434
- id: end-of-file-fixer

README.md

Lines changed: 8 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,13 @@
1-
<!-- lint disable -->
2-
3-
**Documentation**
4-
5-
**Code quality and style**
6-
7-
**Unit tests and coverage**
8-
9-
**How to cite**
10-
11-
**Contributors**
12-
131
# CPP ROI
142

15-
## :warning: :warning: :warning:
3+
---
4+
5+
## :warning:
166

17-
**This code is fairly unstable (:boom:) and might still change a lot.**
7+
**This code is fairly unstable and might still change.**
188

19-
Also this code currently has 0% test coverage...
9+
So make sure you "pin" which version or commit you are using for a given
10+
project, if you don't want your code to break in the future.
2011

2112
---
2213

@@ -57,7 +48,7 @@ as a submodule, and intitialized when running `initCppSpm`.
5748

5849
### Dependencies
5950

60-
TODO
51+
======= TODO
6152

6253
| Dependencies | Used version |
6354
| ---------------------------------------------------------- | ------------ |
@@ -97,10 +88,4 @@ TODO
9788
Also includes:
9889

9990
- Yeo's 7 networks "atlas"
100-
- add REF and URL
101-
102-
103-
104-
## Contributing
105-
106-
## Contributors
91+
<!-- add REF and URL -->

demos/WIP/get_ROI_Coordinates.m

Lines changed: 150 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,150 @@
1+
function mni = get_ROI_Coordinates
2+
% This function gets the individual subject coordniates of the highest peak
3+
% within a specified Region of interest (usually coming
4+
% from the group level univariate analysis)
5+
%
6+
% Critical t-value for each experimental condition or mask file
7+
% Critical t-value for visual condition in L-V5 and R-V5 and bilateral PT
8+
%
9+
% (C) Copyright 2021 CPP ROI developers
10+
11+
CriticalTs = 1;
12+
13+
%% load the data structure
14+
WD = pwd;
15+
16+
%% group of subjects to analyze
17+
opt.groups = {'EB', 'SCa', 'SCv'}; % {'EB','SCa','SCv'};
18+
% suject to run in each group
19+
opt.subjects = {[1:13], [1:10], [1:6]}; % {[1:13],[1:10],[1:6]};
20+
21+
%%
22+
smoothing = '6';
23+
24+
%% Regions that will be used to extract the highest t-value within that mask
25+
maskFn = { 'face_lFFA.nii'
26+
'face_rFFA.nii'
27+
};
28+
29+
CriticalTs = ones(1, length(maskFn)) * CriticalTs;
30+
31+
%% Location of the data
32+
data_path = '/Volumes/SanDisk/Oli_Data/Categs_BIDS/derivatives';
33+
34+
% create an mni cell with dimensions (1x number of masks)
35+
mni = cell(1, length(maskFn));
36+
SubNames = {};
37+
38+
% for each mask
39+
for iMask = 1:length(maskFn)
40+
41+
fprintf('Running Mask %.0f \n\n', iMask);
42+
CriticalT = CriticalTs(iMask); % get the critical t
43+
44+
subCounter = 0;
45+
for iGroup = 1:length(opt.groups)
46+
for iSub = 1:length(opt.subjects{iGroup})
47+
48+
fprintf('Running Subject %.0f \n', iSub);
49+
50+
SubName = ['sub-', opt.groups{iGroup}, ...
51+
sprintf('%02d', opt.subjects{iGroup}(iSub))];
52+
53+
fprintf('%s \n', SubName);
54+
subCounter = subCounter + 1;
55+
SubNames{subCounter, iMask} = SubName(5:end);
56+
57+
%% the first 4 masks are for the FACE condition, the other 4
58+
% are from the SCENE condition
59+
if iMask <= 2
60+
result_file = [data_path, '/', ...
61+
SubName, ...
62+
'/stats/ffx_visMotion/ffx_', ...
63+
smoothing, ...
64+
'/spmT_0013.nii']; % HUMAN > BIG_ENV
65+
else
66+
result_file = [data_path, '/', ...
67+
SubName, ...
68+
'/stats/ffx_audMotion/ffx_', ...
69+
smoothing, ...
70+
'/spmT_0014.nii']; % BIG_ENV > HUMAN
71+
end
72+
73+
%%
74+
mask_path = fullfile(WD, 'Kanwisher_ROIs', maskFn{iMask});
75+
76+
r = load_nii(result_file);
77+
m = load_nii(mask_path);
78+
79+
r.img(~m.img) = nan;
80+
81+
maxVal = max(r.img(:));
82+
maxVals(subCounter, iMask) = maxVal;
83+
84+
if maxVal > CriticalT %|| maxVal < CriticalT
85+
86+
% Get the location of the higest t-value in slice space
87+
voxel_idx = find(r.img == maxVal);
88+
89+
disp(maxVal);
90+
[x, y, z] = ind2sub(size(r.img), voxel_idx);
91+
92+
% convert space from slice number to mni
93+
mni{1, iMask}(subCounter, :) = cor2mni([x y z], mask_path);
94+
95+
% mni{1,iMask}(iSub,1) = mni{1,iMask}(iSub,1)* -1;
96+
% If masks created from AFNI or FSL,
97+
% the x coordinate could be flipped (multiplied x -1).
98+
% If this is the case, multiply x with -1.
99+
100+
mni{1, iMask}(subCounter, :);
101+
102+
else
103+
mni{1, iMask}(subCounter, 1:3) = nan;
104+
end
105+
106+
end
107+
end
108+
end
109+
110+
save('mni_coordinates.mat', 'mni', 'maskFn', 'opt', 'maxVals', 'SubNames');
111+
end
112+
113+
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
114+
%%% cor2mni
115+
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
116+
function mni = cor2mni(cor, nifti_image)
117+
% function mni = cor2mni(cor, T)
118+
% convert matrix coordinate to mni coordinate
119+
%
120+
% cor: an Nx3 matrix
121+
% T: (optional) rotation matrix
122+
% mni is the returned coordinate in mni space
123+
%
124+
% caution: if T is not given, the default T is
125+
% T = ...
126+
% [-4 0 0 84;...
127+
% 0 4 0 -116;...
128+
% 0 0 4 -56;...
129+
% 0 0 0 1];
130+
%
131+
% xu cui
132+
% 2004-8-18
133+
% last revised: 2005-04-30
134+
135+
% if nargin == 1
136+
% T = ...
137+
% [-4 0 0 84;...
138+
% 0 4 0 -116;...
139+
% 0 0 4 -56;...
140+
% 0 0 0 1];
141+
% end
142+
143+
V = spm_vol(nifti_image);
144+
T = V.mat;
145+
146+
cor = round(cor);
147+
mni = T * [cor(:, 1) cor(:, 2) cor(:, 3) ones(size(cor, 1), 1)]';
148+
mni = mni';
149+
mni(:, 4) = [];
150+
end

docs/CONTRIBUTING.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

docs/Makefile

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

docs/source/conf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,15 @@
2323
author = "the CPP ROI dev team"
2424

2525
# The full version, including alpha/beta/rc tags
26-
release = "v0.1.0"
26+
release = "v0.1.0dev"
2727

2828

2929
# -- General configuration ---------------------------------------------------
3030

3131
# Add any Sphinx extension module names here, as strings. They can be
3232
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
3333
# ones.
34-
extensions = ["sphinxcontrib.matlab", "sphinx.ext.autodoc"]
34+
extensions = ["sphinxcontrib.matlab", "sphinx.ext.autodoc", "sphinx_copybutton"]
3535
matlab_src_dir = os.path.dirname(os.path.abspath("../../src"))
3636
primary_domain = "mat"
3737

0 commit comments

Comments
 (0)