annotate aim-mat/modules/usermodule/mellin/displaymellin2.m @ 4:537f939baef0 tip

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