Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
1530a16
Merge pull request #145 from cpp-lln-lab/dev
Remi-Gau Nov 1, 2020
cc5b636
fix contributor bot json
Remi-Gau Nov 17, 2020
9c02da5
Merge pull request #185 from Remi-Gau/remi-fix_contributor_bot
Remi-Gau Nov 17, 2020
9da5478
docs: update README.md [skip ci]
allcontributors[bot] Nov 17, 2020
78ad40d
docs: update .all-contributorsrc [skip ci]
allcontributors[bot] Nov 17, 2020
858f3cb
Merge pull request #186 from cpp-lln-lab/all-contributors/add-marcoba…
Remi-Gau Nov 17, 2020
e24480f
docs: update README.md [skip ci]
allcontributors[bot] Nov 29, 2020
b6d7e91
docs: update .all-contributorsrc [skip ci]
allcontributors[bot] Nov 29, 2020
df0f501
Merge branch 'master' into all-contributors/add-marcobarilari
Remi-Gau Nov 29, 2020
57e33fc
Merge pull request #203 from cpp-lln-lab/all-contributors/add-marcoba…
Remi-Gau Nov 29, 2020
70d6e10
docs: update README.md [skip ci]
allcontributors[bot] Nov 29, 2020
2b1bd7e
docs: update .all-contributorsrc [skip ci]
allcontributors[bot] Nov 29, 2020
b5e03ff
Merge pull request #204 from cpp-lln-lab/all-contributors/add-fedefalag
Remi-Gau Nov 29, 2020
75864bd
docs: update README.md [skip ci]
allcontributors[bot] Nov 29, 2020
81ae18c
docs: update .all-contributorsrc [skip ci]
allcontributors[bot] Nov 29, 2020
6f2f6b6
Merge pull request #205 from cpp-lln-lab/all-contributors/add-CerenB
Remi-Gau Nov 29, 2020
93f5d03
docs: update README.md [skip ci]
allcontributors[bot] Nov 29, 2020
a72dadf
docs: update .all-contributorsrc [skip ci]
allcontributors[bot] Nov 29, 2020
7fe5505
Merge branch 'master' into all-contributors/add-CerenB
Remi-Gau Nov 29, 2020
b7001cc
Merge pull request #206 from cpp-lln-lab/all-contributors/add-CerenB
Remi-Gau Nov 29, 2020
f86185f
docs: update README.md [skip ci]
allcontributors[bot] Nov 29, 2020
fc28147
docs: update .all-contributorsrc [skip ci]
allcontributors[bot] Nov 29, 2020
4a5dee2
Merge pull request #207 from cpp-lln-lab/all-contributors/add-Remi-Gau
Remi-Gau Nov 29, 2020
b96b266
Merge remote-tracking branch 'cpp-lln-lab/master' into dev
CerenB Nov 30, 2020
46f3f16
Merge remote-tracking branch 'cpp-lln-lab/dev' into dev
CerenB Dec 13, 2020
794f63b
bids matlab master branch update
CerenB Jan 5, 2021
6ea3e32
Merge remote-tracking branch 'cpp-lln-lab/dev' into dev
CerenB Jan 5, 2021
d269f73
parfor loop added
CerenB Jan 7, 2021
fe76134
mh_style fix
CerenB Jan 7, 2021
0fcd9fd
Update src/workflows/bidsSpatialPrepro.m
CerenB Jan 7, 2021
84a5b94
make sure that when set to false parallel.do only uses 1 worker
Remi-Gau Jan 7, 2021
e81402a
mh autofix
Remi-Gau Jan 7, 2021
9557217
Merge pull request #1 from Remi-Gau/remi-parfor_maangement
CerenB Jan 7, 2021
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
35 changes: 31 additions & 4 deletions .all-contributorsrc
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"doc"
]
},
{
"login": "anege",
"name": "anege",
"avatar_url": "https://avatars0.githubusercontent.com/u/50317099?v=4",
Expand All @@ -26,6 +27,7 @@
"design"
]
},
{
"login": "mohmdrezk",
"name": "Mohamed Rezk",
"avatar_url": "https://avatars2.githubusercontent.com/u/9597815?v=4",
Expand All @@ -36,6 +38,7 @@
"design"
]
},
{
"login": "marcobarilari",
"name": "marcobarilari",
"avatar_url": "https://avatars3.githubusercontent.com/u/38101692?v=4",
Expand All @@ -44,7 +47,9 @@
"code",
"design",
"review",
"doc"
"doc",
"test",
"bug"
]
},
{
Expand All @@ -57,13 +62,35 @@
"doc",
"infra",
"design",
"review"
"review",
"bug"
]
},
{
"login": "fedefalag",
"name": "Fede F.",
"avatar_url": "https://avatars2.githubusercontent.com/u/50373329?v=4",
"profile": "https://github.com/fedefalag",
"contributions": [
"bug"
]
},
{
"login": "CerenB",
"name": "CerenB",
"avatar_url": "https://avatars1.githubusercontent.com/u/10451654?v=4",
"profile": "https://github.com/CerenB",
"contributions": [
"bug",
"content",
"doc"
]
}
],
"contributorsPerLine": 7,
"projectName": "CPP_BIDS_SPM_pipeline",
"projectName": "CPP_SPM",
"projectOwner": "cpp-lln-lab",
"repoType": "github",
"repoHost": "https://github.com"
"repoHost": "https://github.com",
"skipCi": true
}
23 changes: 13 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@
**Contributors**

<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->

[![All Contributors](https://img.shields.io/badge/all_contributors-5-orange.svg?style=flat-square)](#contributors)

[![All Contributors](https://img.shields.io/badge/all_contributors-7-orange.svg?style=flat-square)](#contributors-)
<!-- ALL-CONTRIBUTORS-BADGE:END -->

<!-- lint enable -->
Expand Down Expand Up @@ -101,17 +99,22 @@ Thanks goes to these wonderful people
([emoji key](https://allcontributors.org/docs/en/emoji-key)):

<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
<!-- lint disable -->
<!-- prettier-ignore-start -->
<!-- markdownlint-disable -->
<table>
<tr>
<td align="center"><a href="https://cpplab.be"><img src="https://avatars0.githubusercontent.com/u/55407947?v=4" width="100px;" alt="OliColli"/><br /><sub><b>OliColli</b></sub></a><br /><a href="https://github.com/cpp-lln-lab/CPP_BIDS_SPM_pipeline/commits?author=OliColli" title="Code">💻</a> <a href="#design-OliColli" title="Design">🎨</a> <a href="https://github.com/cpp-lln-lab/CPP_BIDS_SPM_pipeline/commits?author=OliColli" title="Documentation">📖</a></td>
<td align="center"><a href="https://github.com/anege"><img src="https://avatars0.githubusercontent.com/u/50317099?v=4" width="100px;" alt="anege"/><br /><sub><b>anege</b></sub></a><br /><a href="https://github.com/cpp-lln-lab/CPP_BIDS_SPM_pipeline/commits?author=anege" title="Code">💻</a> <a href="#design-anege" title="Design">🎨</a></td>
<td align="center"><a href="https://github.com/mohmdrezk"><img src="https://avatars2.githubusercontent.com/u/9597815?v=4" width="100px;" alt="Mohamed Rezk"/><br /><sub><b>Mohamed Rezk</b></sub></a><br /><a href="https://github.com/cpp-lln-lab/CPP_BIDS_SPM_pipeline/commits?author=mohmdrezk" title="Code">💻</a> <a href="#review-mohmdrezk" title="Reviewed Pull Requests">👀</a> <a href="#design-mohmdrezk" title="Design">🎨</a></td>
<td align="center"><a href="https://github.com/marcobarilari"><img src="https://avatars3.githubusercontent.com/u/38101692?v=4" width="100px;" alt="marcobarilari"/><br /><sub><b>marcobarilari</b></sub></a><br /><a href="https://github.com/cpp-lln-lab/CPP_BIDS_SPM_pipeline/commits?author=marcobarilari" title="Code">💻</a> <a href="#design-marcobarilari" title="Design">🎨</a> <a href="#review-marcobarilari" title="Reviewed Pull Requests">👀</a> <a href="https://github.com/cpp-lln-lab/CPP_BIDS_SPM_pipeline/commits?author=marcobarilari" title="Documentation">📖</a></td>
<td align="center"><a href="https://remi-gau.github.io/"><img src="https://avatars3.githubusercontent.com/u/6961185?v=4" width="100px;" alt="Remi Gau"/><br /><sub><b>Remi Gau</b></sub></a><br /><a href="https://github.com/cpp-lln-lab/CPP_BIDS_SPM_pipeline/commits?author=Remi-Gau" title="Code">💻</a> <a href="https://github.com/cpp-lln-lab/CPP_BIDS_SPM_pipeline/commits?author=Remi-Gau" title="Documentation">📖</a> <a href="#infra-Remi-Gau" title="Infrastructure (Hosting, Build-Tools, etc)">🚇</a> <a href="#design-Remi-Gau" title="Design">🎨</a> <a href="#review-mohmdrezk" title="Reviewed Pull Requests">👀</a></td>
<td align="center"><a href="https://cpplab.be"><img src="https://avatars0.githubusercontent.com/u/55407947?v=4" width="100px;" alt=""/><br /><sub><b>OliColli</b></sub></a><br /><a href="https://github.com/cpp-lln-lab/CPP_SPM/commits?author=OliColli" title="Code">💻</a> <a href="#design-OliColli" title="Design">🎨</a> <a href="https://github.com/cpp-lln-lab/CPP_SPM/commits?author=OliColli" title="Documentation">📖</a></td>
<td align="center"><a href="https://github.com/anege"><img src="https://avatars0.githubusercontent.com/u/50317099?v=4" width="100px;" alt=""/><br /><sub><b>anege</b></sub></a><br /><a href="https://github.com/cpp-lln-lab/CPP_SPM/commits?author=anege" title="Code">💻</a> <a href="#design-anege" title="Design">🎨</a></td>
<td align="center"><a href="https://github.com/mohmdrezk"><img src="https://avatars2.githubusercontent.com/u/9597815?v=4" width="100px;" alt=""/><br /><sub><b>Mohamed Rezk</b></sub></a><br /><a href="https://github.com/cpp-lln-lab/CPP_SPM/commits?author=mohmdrezk" title="Code">💻</a> <a href="https://github.com/cpp-lln-lab/CPP_SPM/pulls?q=is%3Apr+reviewed-by%3Amohmdrezk" title="Reviewed Pull Requests">👀</a> <a href="#design-mohmdrezk" title="Design">🎨</a></td>
<td align="center"><a href="https://github.com/marcobarilari"><img src="https://avatars3.githubusercontent.com/u/38101692?v=4" width="100px;" alt=""/><br /><sub><b>marcobarilari</b></sub></a><br /><a href="https://github.com/cpp-lln-lab/CPP_SPM/commits?author=marcobarilari" title="Code">💻</a> <a href="#design-marcobarilari" title="Design">🎨</a> <a href="https://github.com/cpp-lln-lab/CPP_SPM/pulls?q=is%3Apr+reviewed-by%3Amarcobarilari" title="Reviewed Pull Requests">👀</a> <a href="https://github.com/cpp-lln-lab/CPP_SPM/commits?author=marcobarilari" title="Documentation">📖</a> <a href="https://github.com/cpp-lln-lab/CPP_SPM/commits?author=marcobarilari" title="Tests">⚠️</a> <a href="https://github.com/cpp-lln-lab/CPP_SPM/issues?q=author%3Amarcobarilari" title="Bug reports">🐛</a></td>
<td align="center"><a href="https://remi-gau.github.io/"><img src="https://avatars3.githubusercontent.com/u/6961185?v=4" width="100px;" alt=""/><br /><sub><b>Remi Gau</b></sub></a><br /><a href="https://github.com/cpp-lln-lab/CPP_SPM/commits?author=Remi-Gau" title="Code">💻</a> <a href="https://github.com/cpp-lln-lab/CPP_SPM/commits?author=Remi-Gau" title="Documentation">📖</a> <a href="#infra-Remi-Gau" title="Infrastructure (Hosting, Build-Tools, etc)">🚇</a> <a href="#design-Remi-Gau" title="Design">🎨</a> <a href="https://github.com/cpp-lln-lab/CPP_SPM/pulls?q=is%3Apr+reviewed-by%3ARemi-Gau" title="Reviewed Pull Requests">👀</a> <a href="https://github.com/cpp-lln-lab/CPP_SPM/issues?q=author%3ARemi-Gau" title="Bug reports">🐛</a></td>
<td align="center"><a href="https://github.com/fedefalag"><img src="https://avatars2.githubusercontent.com/u/50373329?v=4" width="100px;" alt=""/><br /><sub><b>Fede F.</b></sub></a><br /><a href="https://github.com/cpp-lln-lab/CPP_SPM/issues?q=author%3Afedefalag" title="Bug reports">🐛</a></td>
<td align="center"><a href="https://github.com/CerenB"><img src="https://avatars1.githubusercontent.com/u/10451654?v=4" width="100px;" alt=""/><br /><sub><b>CerenB</b></sub></a><br /><a href="https://github.com/cpp-lln-lab/CPP_SPM/issues?q=author%3ACerenB" title="Bug reports">🐛</a> <a href="#content-CerenB" title="Content">🖋</a> <a href="https://github.com/cpp-lln-lab/CPP_SPM/commits?author=CerenB" title="Documentation">📖</a></td>
</tr>
</table>
<!-- lint enable -->

<!-- markdownlint-enable -->
<!-- prettier-ignore-end -->
<!-- ALL-CONTRIBUTORS-LIST:END -->

This project follows the
Expand Down
13 changes: 11 additions & 2 deletions src/utils/manageWorkersPool.m
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,12 @@ function manageWorkersPool(action, opt)
% opt.parallelize.killOnExit = true;
%

if ~isOctave() && opt.parallelize.do
if ~opt.parallelize.do
opt.parallelize.nbWorkers = 1;
opt.parallelize.killOnExit = true;
end

if ~isOctave()

matlabVer = version('-release');

Expand Down Expand Up @@ -56,7 +61,11 @@ function manageWorkersPool(action, opt)
if opt.parallelize.killOnExit

if str2double(matlabVer(1:4)) > 2013
delete(gcp);

pool = gcp('nocreate');
if ~isempty(pool)
delete(gcp);
end

else
matlabpool close;
Expand Down
14 changes: 9 additions & 5 deletions src/workflows/bidsSpatialPrepro.m
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,20 @@ function bidsSpatialPrepro(opt)

[BIDS, opt, group] = setUpWorkflow(opt, 'spatial preprocessing');

opt.orderBatches.selectAnat = 1;
opt.orderBatches.realign = 2;
opt.orderBatches.coregister = 3;
opt.orderBatches.saveCoregistrationMatrix = 4;
opt.orderBatches.segment = 5;
opt.orderBatches.skullStripping = 6;
opt.orderBatches.skullStrippingMask = 7;

%% Loop through the groups, subjects, and sessions
for iGroup = 1:length(group)

groupName = group(iGroup).name;

for iSub = 1:group(iGroup).numSub
parfor iSub = 1:group(iGroup).numSub

matlabbatch = [];
% Get the ID of the subject
Expand All @@ -60,25 +68,21 @@ function bidsSpatialPrepro(opt)
printProcessingSubject(groupName, iSub, subID);

matlabbatch = setBatchSelectAnat(matlabbatch, BIDS, opt, subID);
opt.orderBatches.selectAnat = 1;

% if action is emtpy then only realign will be done
action = [];
if ~opt.realign.useUnwarp
action = 'realign';
end
[matlabbatch, voxDim] = setBatchRealign(matlabbatch, action, BIDS, opt, subID);
opt.orderBatches.realign = 2;

% dependency from file selector ('Anatomical')
matlabbatch = setBatchCoregistrationFuncToAnat(matlabbatch, BIDS, opt, subID);
opt.orderBatches.coregister = 3;

matlabbatch = setBatchSaveCoregistrationMatrix(matlabbatch, BIDS, opt, subID);

% dependency from file selector ('Anatomical')
matlabbatch = setBatchSegmentation(matlabbatch, opt);
opt.orderBatches.segment = 5;

matlabbatch = setBatchSkullStripping(matlabbatch, BIDS, opt, subID);

Expand Down
69 changes: 69 additions & 0 deletions tests/test_manageWorkersPool.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
function test_suite = test_manageWorkersPool %#ok<*STOUT>
try % assignment of 'localfunctions' is necessary in Matlab >= 2016
test_functions = localfunctions(); %#ok<*NASGU>
catch % no problem; early Matlab versions can use initTestSuite fine
end
initTestSuite;
end

function test_manageWorkersPoolBasic()

opt.parallelize.do = true;
opt.parallelize.nbWorkers = 3;
opt.parallelize.killOnExit = true;

matlabVer = version('-release');

manageWorkersPool('close', opt);

manageWorkersPool('open', opt);

if ~isOctave()
if str2double(matlabVer(1:4)) > 2013

pool = gcp('nocreate');
nbWorkers = pool.NumWorkers;

else
nbWorkers = matlabpool('size'); %#ok<DPOOL>

end

manageWorkersPool('close', opt);

assertEqual(nbWorkers, opt.parallelize.nbWorkers);

end

end

function test_manageWorkersPoolNoParallel()

opt.parallelize.do = false;
opt.parallelize.nbWorkers = 3;
opt.parallelize.killOnExit = true;

matlabVer = version('-release');

manageWorkersPool('close', opt);

manageWorkersPool('open', opt);

if ~isOctave()
if str2double(matlabVer(1:4)) > 2013

pool = gcp('nocreate');
nbWorkers = pool.NumWorkers;

else
nbWorkers = matlabpool('size'); %#ok<DPOOL>

end

manageWorkersPool('close', opt);

assertEqual(nbWorkers, 1);

end

end