Skip to content

Commit 22d9bd6

Browse files
committed
move function from bidspm
1 parent 2216a0a commit 22d9bd6

File tree

3 files changed

+19
-9
lines changed

3 files changed

+19
-9
lines changed

src/atlas/extractRoiFromAtlas.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
args = inputParser;
4040

4141
addRequired(args, 'outputDir', isChar);
42-
addRequired(args, 'atlasName', @isAKnownAtlas);
42+
addRequired(args, 'atlasName', @(x) isAKnownAtlas(x));
4343
addRequired(args, 'roiName', isChar);
4444
addRequired(args, 'hemisphere', @(x) ismember(x, {'L', 'R'}));
4545

src/atlas/isAKnownAtlas.m

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
function isAKnownAtlas(atlasName)
22
% (C) Copyright 2021 CPP ROI developers
3-
if ~ismember(lower(atlasName), {'anatomy_toobox', ...
4-
'glasser', ...
5-
'hcpex', ...
6-
'neuromorphometrics', ...
7-
'visfatlas', ...
8-
'wang'})
9-
% TODO throw a proper error here
10-
error('unknown atlas type');
3+
if ~ismember(lower(atlasName), supportedAtlases())
4+
msg = sprintf('Suppored atlases are: %s\nGot: "%s"', ...
5+
bids.internal.create_unordered_list(supportedAtlases()), ...
6+
lower(atlasName));
7+
bids.internal.error_handling(mfilename(), ...
8+
'unknownAtlas', msg, false);
119
end
1210
end

src/atlas/supportedAtlases.m

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
function value = supportedAtlases()
2+
% Return a cell array of supported atlases
3+
4+
% (C) Copyright 2022 CPP ROI developers
5+
value = {
6+
'anatomy_toobox', ...
7+
'glasser', ...
8+
'hcpex', ...
9+
'neuromorphometrics', ...
10+
'visfatlas', ...
11+
'wang'};
12+
end

0 commit comments

Comments
 (0)