-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathshowdic.m
executable file
·48 lines (41 loc) · 1.32 KB
/
showdic.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
function DicMap=showdic(MaskIm,DefDic)
% Show MASK object dictionary.
% Package: @MASK
% Description: Get dictionary for a MASK object and print it to screen.
% Input : - MASK object.
% - Default dictionary function name or structure containing
% dictionary. Defauly is @MASK.def_bitmask_pipeline.
% Output : - Dictionary map.
% License: GNU general public license version 3
% Tested : Matlab R2015b
% By : Eran O. Ofek Apr 2016
% URL : http://weizmann.ac.il/home/eofek/matlab/
% Example: DicMap=showdic(S);
% [~,~,BitSt]=val2bitname(S,17);showdic(BitSt)
% Reliable: 2
%--------------------------------------------------------------------------
MaskDicField = 'MaskDic';
Def.Dic = @MASK.def_bitmask_pipeline;
if (nargin==1),
DefDic = Def.Dic;
elseif (nargin==2),
% do nothing
else
error('Illegal number of input arguments');
end
if (isempty(MaskIm(1).(MaskDicField))),
Dic = DefDic;
else
Dic = MaskIm(1).(MaskDicField);
end
if (isa(Dic,'function_handle')),
[~,DicMap] = Dic();
else
DicMap = Dic;
end
Ndic = numel(DicMap);
fprintf(' Bit Name Index Decimal\n')
fprintf(' ---------------------- ----- -------\n')
for Idic=1:1:Ndic,
fprintf(' %-25s %2d %d\n',DicMap(Idic).Name,DicMap(Idic).Ind,2.^DicMap(Idic).Ind);
end