tomwalters@0
|
1 % generating function for 'aim-mat'
|
tomwalters@0
|
2 %
|
tomwalters@0
|
3 % INPUT VALUES:
|
tomwalters@0
|
4 %
|
tomwalters@0
|
5 % RETURN VALUE:
|
tomwalters@0
|
6 %
|
tomwalters@0
|
7 %
|
bleeck@3
|
8 % (c) 2011, University of Southampton
|
bleeck@3
|
9 % Maintained by Stefan Bleeck (bleeck@gmail.com)
|
bleeck@3
|
10 % download of current version is on the soundsoftware site:
|
bleeck@3
|
11 % http://code.soundsoftware.ac.uk/projects/aimmat
|
bleeck@3
|
12 % documentation and everything is on http://www.acousticscale.org
|
bleeck@3
|
13
|
tomwalters@0
|
14
|
tomwalters@0
|
15 function displaymellin(mellin,options,frame_number,ax)
|
tomwalters@0
|
16 if nargin<4
|
tomwalters@0
|
17 ax=gca;
|
tomwalters@0
|
18 end
|
tomwalters@0
|
19
|
tomwalters@0
|
20 %setup the scale bar to alter to range of the colour map
|
tomwalters@0
|
21 %converts the exponential scale on the scale bar to a value 0<x<1
|
tomwalters@0
|
22 if (isfield(options, 'handles'))
|
tomwalters@0
|
23 slider_value = slidereditcontrol_get_value(options.handles.slideredit_scale);
|
tomwalters@0
|
24 else
|
tomwalters@0
|
25 slider_value = options.current_scale;
|
tomwalters@0
|
26 end
|
tomwalters@0
|
27 options.max_value=(-log10(slider_value)+3.001)/6;
|
tomwalters@0
|
28
|
tomwalters@0
|
29 % disp('the max value of the colour map is:');
|
tomwalters@0
|
30 % disp(options.max_value);
|
tomwalters@0
|
31
|
tomwalters@0
|
32 %read in the mellin information to matricies
|
tomwalters@0
|
33 current_frame=mellin{1,frame_number};
|
tomwalters@0
|
34 matrix_of_current_frame=getvalues(current_frame);
|
tomwalters@0
|
35
|
tomwalters@0
|
36 % maah: Normalization for each frame
|
tomwalters@0
|
37 if (max(max(matrix_of_current_frame))>0) % TCW AIM2006 - fixed divide by zero warnings
|
tomwalters@0
|
38 matrix_of_current_frame = matrix_of_current_frame / max(max(matrix_of_current_frame));
|
tomwalters@0
|
39 end
|
tomwalters@0
|
40
|
tomwalters@0
|
41 % % maah: Maybe a threshold can help against this blur!
|
tomwalters@0
|
42 % if (options.threshold ~= 0)
|
tomwalters@0
|
43 % if (options.threshold ~= 1)
|
tomwalters@0
|
44 % matrix_of_current_frame(matrix_of_current_frame < options.threshold) = 0;
|
tomwalters@0
|
45 % else
|
tomwalters@0
|
46 % mean_value = mean(mean(matrix_of_current_frame));
|
tomwalters@0
|
47 % matrix_of_current_frame(matrix_of_current_frame < mean_value) = 0;
|
tomwalters@0
|
48 % end;
|
tomwalters@0
|
49 % end;
|
tomwalters@0
|
50
|
tomwalters@0
|
51 %set the range of values for the axes
|
tomwalters@0
|
52 coef_range=[0,max(options.c_2pi)];
|
tomwalters@0
|
53 h_range=[0,max(options.TFval)];
|
tomwalters@0
|
54
|
tomwalters@0
|
55 %set the resolution of the axes
|
tomwalters@0
|
56 coef_step=(coef_range(1,2)-coef_range(1,1))/10;
|
tomwalters@0
|
57 %h_step=(h_range(1,2)-h_range(1,1))/10;
|
tomwalters@0
|
58 h_step=1;
|
tomwalters@0
|
59
|
tomwalters@0
|
60 %sets the axis divisions
|
tomwalters@0
|
61 coef_axis = [coef_range(1,1):coef_step:coef_range(1,2)];
|
tomwalters@0
|
62 h_axis = [h_range(1,1):h_step:h_range(1,2)];
|
tomwalters@0
|
63
|
tomwalters@0
|
64 %this section sets up the colormap to be the correct gray scale version that we want
|
tomwalters@0
|
65 colormap_name=gray(128); % maah: was = gray(128)
|
tomwalters@0
|
66 size_colormap=size(colormap_name);
|
tomwalters@0
|
67 %disp(size_colormap);
|
tomwalters@0
|
68 for ii=1:size_colormap(1);
|
tomwalters@0
|
69 rich_map(ii,:)=colormap_name((129-ii),:);
|
tomwalters@0
|
70 end;
|
tomwalters@0
|
71 colormap(rich_map);
|
tomwalters@0
|
72
|
tomwalters@0
|
73
|
tomwalters@0
|
74 %now we generate the image matlab automatically scales the colours
|
tomwalters@0
|
75 %note that we take the magnitude of the components
|
tomwalters@0
|
76 %we reset the the colourmap, scaling it's maximum to 1
|
tomwalters@0
|
77 %matrix_of_current_frame = matrix_of_current_frame'; %removed the transpose
|
tomwalters@0
|
78 %in the display function and put it into the generating function
|
tomwalters@0
|
79 mellin_image = image(h_axis, coef_axis, matrix_of_current_frame,'CDataMapping','scaled','parent',ax);
|
tomwalters@0
|
80
|
tomwalters@0
|
81 set(ax,'CLimMode','manual');
|
tomwalters@0
|
82 % set(ax,'CLim',[0 options.max_value]);
|
tomwalters@0
|
83
|
tomwalters@0
|
84 %now we scale the image so that it fills the display area
|
tomwalters@0
|
85 limitx=ceil(max(h_axis));
|
tomwalters@0
|
86 limity=ceil(max(coef_axis));
|
tomwalters@0
|
87 set(ax,'XLim',[0 limitx]);
|
tomwalters@0
|
88 set(ax,'YLim',[0 limity]);
|
tomwalters@0
|
89
|
tomwalters@0
|
90 %here we setup the scale and location of the axes
|
tomwalters@0
|
91 set(ax,'XTick', h_axis);
|
tomwalters@0
|
92 set(ax,'XTickLabel', h_axis,'FontSize',8);
|
tomwalters@0
|
93
|
tomwalters@0
|
94 set(ax,'YTick', coef_axis);
|
tomwalters@0
|
95 set(ax,'YTickLabel', coef_axis,'FontSize',8,'YAxisLocation','right');
|
tomwalters@0
|
96
|
tomwalters@0
|
97 %flip the y axis
|
tomwalters@0
|
98 set(ax,'YDir','normal')
|
tomwalters@0
|
99
|
tomwalters@0
|
100 %and put on the labels
|
tomwalters@0
|
101 mellin_image = xlabel('Time-Interval, Peak-Frequency product, \ith','FontSize',8);
|
tomwalters@0
|
102 mellin_image = ylabel('Mellin variable, \it{c/2\pi}','FontSize',8); |