-
Notifications
You must be signed in to change notification settings - Fork 2
/
name2structureID.m
72 lines (64 loc) · 1.55 KB
/
name2structureID.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
function [IDs,ARA_LIST]=name2structureID(names,ARA_LIST,quiet)
% Convert a list of ARA (Allen Reference Atlas) area names to a vector of structure IDs
%
% function [IDs,ARA_LIST]=name2structureID(names,ARA_LIST,quiet)
%
% Purpose
% Each Allen Reference Atlas (ARA) brain area is associated with a unique
% number (structure ID), a long name and an acronym. This function converts
% the acronym to an area structure ID number.
%
%
% Inputs
% names - a cell array (if a list) of brain area names or a single string.
% ARA_LIST - [optional] the first output of getAllenStructureList
% quiet - [optional, false by default] if true, do not print any warning messages
%
%
% Outputs
% IDs - a vector of brain area structure IDs (if more than one acronym was provided)
% ARA_LIST - the CSV data from getAllenStructureList in the form of a cell array
%
%
% Examples
%
% >> name2structureID('Paraflocculus')
%
%ans =
%
% int32
%
% 1041
%
%
%
% Rob Campbell
%
% See also:
% getAllenStructureList, structureID2name
if isstr(names)
names={names};
end
if nargin<2 || isempty(ARA_LIST)
ARA_LIST = getAllenStructureList;
end
if nargin<3
quiet = false;
end
IDs=[];
%loop through and find all the names
for ii=1:length(names)
f=strmatch(lower(names{ii}),lower(ARA_LIST.name),'exact');
if isempty(f)
if ~quiet
fprintf('%s finds no name %s in the atlas\n',mfilename, names{ii})
end
continue
end
if length(f)>1
if ~quiet
error('found more than one ID index')
end
end
IDs(ii) = ARA_LIST.id(f);
end