Subversion Repositories lagranto.um

Rev

Rev 3 | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 3 Rev 6
1
function output = col_load(coltable, spacing, shift, varargin)
1
function output = col_load(coltable, spacing, shift, varargin)
2
% Routine handles colortable
2
% Routine handles colortable
3
%
3
%
4
% coltable  input    string contains ctb-file and its path
4
% coltable  input    string contains ctb-file and its path
5
%                    e.g. /home/user/matlab/.../file
5
%                    e.g. /home/user/matlab/.../file
6
%
6
%
7
%                    if only file: path = /home/mischa/matlab/ctb/
7
%                    if only file: path = /home/mischa/matlab/ctb/
8
% 
8
% 
9
% date2     input    shifter for colortable
9
% date2     input    shifter for colortable
10
% 
10
% 
11
% varargin  input    pointer to define a white space                 
11
% varargin  input    pointer to define a white space                 
12
%                  
12
%                  
13
% output    output   nothing
13
% output    output   nothing
14
% 
14
% 
15
% ----------------------------------------------------------
15
% ----------------------------------------------------------
16
%                            Mischa Croci Maspoli (Oct 2004)
16
%                            Mischa Croci Maspoli (Oct 2004)
17
% ----------------------------------------------------------
17
% ----------------------------------------------------------
18
 
18
 
19
%check if varargin = 1
19
%check if varargin = 1
20
if length(varargin) == 1
20
if length(varargin) == 1
21
 white=varargin{1};
21
 white=varargin{1};
22
end
22
end
23
if length(varargin) == 0
23
if length(varargin) == 0
24
 white=0;
24
 white=0;
25
end
25
end
26
 
26
 
27
 
27
 
28
ctbdefault = '/usr/local/matlabtools/ive_ct/';
28
ctbdefault = '/usr/local/matlabtools/ive_ct/';
29
 
29
 
30
 
30
 
31
% read colortable
31
% read colortable
32
if coltable(1) == '/'
32
if coltable(1) == '/'
33
 ivecol = load(coltable,'-ascii');
33
 ivecol = load(coltable,'-ascii');
34
else
34
else
35
 ivecol = load([ctbdefault coltable],'-ascii');
35
 ivecol = load([ctbdefault coltable],'-ascii');
36
end
36
end
37
 
37
 
38
% devide values by 255
38
% devide values by 255
39
ivecol = 1./255.*ivecol;
39
ivecol = 1./255.*ivecol;
40
 
40
 
41
%ivecol=flipdim(ivecol,1);
41
%ivecol=flipdim(ivecol,1);
42
 
42
 
43
% number of colors
43
% number of colors
44
ncol=length(spacing)-2;
44
ncol=length(spacing)-2;
45
 
45
 
46
% shifter
46
% shifter
47
shcol=shift;
47
shcol=shift;
48
 
48
 
49
% define white space
49
% define white space
50
if  length(varargin) == 1
50
if  length(varargin) == 1
51
  newmap = ivecol(shcol:ncol+shcol,:);
51
  newmap = ivecol(shcol:ncol+shcol,:);
52
  newmap(white,:) = 1.;
52
  newmap(white,:) = 1.;
53
else
53
else
54
  newmap = ivecol(shcol:ncol+shcol,:);
54
  newmap = ivecol(shcol:ncol+shcol,:);
55
end
55
end
56
 
56
 
57
%data=[1:ncol+1;1:1:ncol+1]';
57
%data=[1:ncol+1;1:1:ncol+1]';
58
colormap(newmap(:,:));
58
colormap(newmap(:,:));