annotate aim-mat/modules/usermodule/mellin/displaysaicol2.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 displaysaicol(cmap,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 slider_value = slidereditcontrol_get_value(options.handles.slideredit_scale);
tomwalters@0 20 options.max_value=(-log10(slider_value)+3.001)/6;
tomwalters@0 21 % disp('the max value of the colour map is:');
tomwalters@0 22 % disp(options.max_value);
tomwalters@0 23
tomwalters@0 24 %read in the mellin information to matricies
tomwalters@0 25 current_frame=cmap{1,frame_number};
tomwalters@0 26 matrix_of_current_frame=getvalues(current_frame);
tomwalters@0 27
tomwalters@0 28 %set the range of values for the axes
tomwalters@0 29 size_matrix=size(matrix_of_current_frame);
tomwalters@0 30 coef_range=[0,size_matrix(1,1)];
tomwalters@0 31 h_range=[0,size_matrix(1,2)];
tomwalters@0 32
tomwalters@0 33 %set the resolution of the axes
tomwalters@0 34 coef_step=(coef_range(1,2)-coef_range(1,1))/10;
tomwalters@0 35 h_step=(h_range(1,2)-h_range(1,1))/10;
tomwalters@0 36
tomwalters@0 37 %sets the axis divisions
tomwalters@0 38 coef_axis = [coef_range(1,1):coef_step:coef_range(1,2)];
tomwalters@0 39 h_axis = [h_range(1,1):h_step:h_range(1,2)];
tomwalters@0 40
tomwalters@0 41 %this section sets up the colormap to be the correct gray scale version that we want
tomwalters@0 42 colormap_name=gray(128);
tomwalters@0 43 size_colormap=size(colormap_name);
tomwalters@0 44
tomwalters@0 45 for ii=1:size_colormap(1);
tomwalters@0 46 rich_map(ii,:)=colormap_name((129-ii),:);
tomwalters@0 47 end;
tomwalters@0 48 colormap(rich_map);
tomwalters@0 49
tomwalters@0 50 %now we generate the image matlab automatically scales the colours
tomwalters@0 51 %note that we take the magnitude of the components
tomwalters@0 52 %we reset the the colourmap, scaling it's maximum to 1
tomwalters@0 53
tomwalters@0 54 matrix_of_current_frame = matrix_of_current_frame;
tomwalters@0 55 mellin_image = image(h_axis, coef_axis, matrix_of_current_frame,'CDataMapping','scaled');
tomwalters@0 56 shading interp;
tomwalters@0 57 set(gca,'CLimMode','manual');
tomwalters@0 58 set(gca,'CLim',[0 options.max_value]);
tomwalters@0 59
tomwalters@0 60 %now we scale the image so that it fills the display area
tomwalters@0 61 limitx=ceil(max(h_axis));
tomwalters@0 62 limity=ceil(max(coef_axis));
tomwalters@0 63 set(gca,'XLim',[0 limitx]);
tomwalters@0 64 set(gca,'YLim',[0 limity]);
tomwalters@0 65
tomwalters@0 66 %here we setup the scale and location of the axes
tomwalters@0 67 set(gca,'XTick', h_axis);
tomwalters@0 68 set(gca,'XTickLabel', h_axis,'FontSize',8);
tomwalters@0 69
tomwalters@0 70 set(gca,'YTick', coef_axis);
tomwalters@0 71 set(gca,'YTickLabel', coef_axis,'FontSize',8,'YAxisLocation','right');
tomwalters@0 72
tomwalters@0 73 %flip the y axis
tomwalters@0 74 set(gca,'YDir','normal')
tomwalters@0 75
tomwalters@0 76 %and put on the labels
tomwalters@0 77 mellin_image = xlabel('Column in SAI matrix','FontSize',8);
tomwalters@0 78 mellin_image = ylabel('Row in SAI matrix','FontSize',8);