tomwalters@0: % method of class @frame tomwalters@0: % tomwalters@0: % INPUT VALUES: tomwalters@0: % tomwalters@0: % RETURN VALUE: tomwalters@0: % tomwalters@0: % tomwalters@0: % (c) 2003, University of Cambridge, Medical Research Council tomwalters@0: % Stefan Bleeck (stefan@bleeck.de) tomwalters@0: % http://www.mrc-cbu.cam.ac.uk/cnbh/aimmanual tomwalters@0: % $Date: 2003/10/21 14:14:02 $ tomwalters@0: % $Revision: 1.9 $ tomwalters@0: tomwalters@0: function hand=plotfrequencyprofile(current_frame,options,ax) tomwalters@0: tomwalters@0: if nargin<3 tomwalters@0: ax=gca; tomwalters@0: end tomwalters@0: if nargin<2 tomwalters@0: options=[]; tomwalters@0: end tomwalters@0: tomwalters@0: start_time=getminimumtime(current_frame); tomwalters@0: if start_time < 0 % these are frames read in from ams tomwalters@0: % max_time=getmaximumtime(current_frame); tomwalters@0: fr=getpart(current_frame,start_time,0); tomwalters@0: current_frame=reverse(current_frame); tomwalters@0: start_time=0; tomwalters@0: current_frame=setstarttime(current_frame,0); tomwalters@0: end tomwalters@0: tomwalters@0: if isfield(options,'frequency_profile_scale'); tomwalters@0: frequency_profile_scale=options.frequency_profile_scale; tomwalters@0: else tomwalters@0: frequency_profile_scale=1; tomwalters@0: end tomwalters@0: tomwalters@0: %shrink_range indicates, if the axis should not occupy the whole space tomwalters@0: if isfield(options,'shrink_range'); tomwalters@0: shrink_range=options.shrink_range; tomwalters@0: else tomwalters@0: shrink_range=1; tomwalters@0: end tomwalters@0: tomwalters@0: if ~isfield(options,'minimum_time_interval'); tomwalters@0: minimum_time_interval=0; tomwalters@0: else tomwalters@0: minimum_time_interval=options.minimum_time_interval; tomwalters@0: end tomwalters@0: tomwalters@0: if ~isfield(options,'maximum_time_interval'); tomwalters@0: maximum_time_interval=0.035; tomwalters@0: else tomwalters@0: maximum_time_interval=options.maximum_time_interval; tomwalters@0: end tomwalters@0: tomwalters@0: if maximum_time_interval>getmaximumtime(current_frame) tomwalters@0: maximum_time_interval=getmaximumtime(current_frame); tomwalters@0: end tomwalters@0: tomwalters@0: tomwalters@0: if ~isfield(options,'turn_axis_vertically'); tomwalters@0: turn_axis_vertically=1; tomwalters@0: else tomwalters@0: turn_axis_vertically=options.turn_axis_vertically; tomwalters@0: end tomwalters@0: tomwalters@0: tomwalters@0: % frequency sum tomwalters@0: scale_frequency=getscalefrequency(current_frame); tomwalters@0: tomwalters@0: % channel_density=0.015; % passt für 76 channels von 100 bis 6000 tomwalters@0: % hoehe=getnrchannels(current_frame)*channel_density; tomwalters@0: % if hoehe>1 tomwalters@0: % hoehe=1; tomwalters@0: % end tomwalters@0: % tomwalters@0: % rect=[0.856 0.19 0.1 hoehe*0.81]; tomwalters@0: % rect(1:2)=caxes(1:2)+(rect(1:2).*caxes(3:4)); tomwalters@0: % rect(3:4)=rect(3:4).*caxes(3:4); tomwalters@0: % mysubplot(1,1,1,rect, hint); tomwalters@0: tomwalters@0: part_current_frame=getpart(current_frame,minimum_time_interval,maximum_time_interval); tomwalters@0: % if getxaxis(current_frame)=='0' tomwalters@0: % h_cutoff=3; tomwalters@0: % h_width=20; tomwalters@0: % aa=getvalues(part_current_frame); tomwalters@0: % aa=aa(1:601,h_cutoff*h_width:121); tomwalters@0: % part_current_frame=frame(aa/100); tomwalters@0: % end; tomwalters@0: tomwalters@0: fresumme=getfrequencysum(part_current_frame); % here it is calculated tomwalters@0: % fresumme=smooth(fresumme,1);% glätte die Summe tomwalters@0: if getxaxis(current_frame)=='0' tomwalters@0: [band_location band_height]=getlocalmaxima(fresumme); tomwalters@0: band_location=(band_location/601)*30; tomwalters@0: band_information(:,1)=band_location'; tomwalters@0: band_information(:,2)=band_height'; tomwalters@0: % disp('maxima'); tomwalters@0: % disp(' h val height'); tomwalters@0: % disp(band_information); tomwalters@0: [min_posit min_height]=getlocalminima(fresumme); tomwalters@0: min_posit=(min_posit/601)*30; tomwalters@0: band_information2(:,1)=min_posit'; tomwalters@0: band_information2(:,2)=min_height'; tomwalters@0: % disp('minima'); tomwalters@0: % disp(' h val height'); tomwalters@0: % disp(band_information2); tomwalters@0: end; tomwalters@0: tomwalters@0: tomwalters@0: if frequency_profile_scale < 0 tomwalters@0: mscal=max(fresumme); tomwalters@0: if mscal~=0 tomwalters@0: frequency_profile_scale=scale_frequency/mscal*0.9; tomwalters@0: else tomwalters@0: frequency_profile_scale=1; tomwalters@0: end tomwalters@0: end tomwalters@0: tomwalters@0: fresumme=setname(fresumme,''); tomwalters@0: fresumme=setunit_x(fresumme,''); tomwalters@0: fresumme=setunit_y(fresumme,''); tomwalters@0: tomwalters@0: % hand=plot(fresumme,'r'); hold on tomwalters@0: v=getvalues(fresumme); tomwalters@0: hand=plot(ax,v,'r'); hold on tomwalters@0: tomwalters@0: maxy=scale_frequency/frequency_profile_scale; tomwalters@0: if maxy==0 tomwalters@0: maxy=1; tomwalters@0: end tomwalters@0: nr=size(v,1); tomwalters@0: if nr==0 tomwalters@0: nr=1; tomwalters@0: end tomwalters@0: set(ax,'xlim',[0 nr *shrink_range]); tomwalters@0: set(ax,'ylim',[0 maxy]); tomwalters@0: tomwalters@0: % axis([0 nr *shrink_range 0 maxy]); tomwalters@0: tomwalters@0: if turn_axis_vertically==1 tomwalters@0: view(ax,-90,90); tomwalters@0: end tomwalters@0: tomwalters@0: tomwalters@0: % make y-Ticks tomwalters@0: cfs=getcf(current_frame); tomwalters@0: if length(cfs) > 1 tomwalters@0: nr_labels=8; tomwalters@0: nr_channels=getnrpoints(fresumme); tomwalters@0: xstep=(nr_channels-1)/(nr_labels-1); tomwalters@0: tix=1:xstep:nr_channels; tomwalters@0: ti=cfs(floor(tix))/1000; tomwalters@0: else tomwalters@0: ti=cfs; tomwalters@0: tix=0.5; tomwalters@0: end tomwalters@0: ti=round(ti*10)/10; tomwalters@0: tomwalters@0: if getxaxis(current_frame)=='0' tomwalters@0: d=size(cfs); tomwalters@0: ti = [0:5:30]; tomwalters@0: step=(d(2)/6); tomwalters@0: tix = [0:step:d(2)]; tomwalters@0: end; tomwalters@0: tomwalters@0: set(ax,'XTick',tix); tomwalters@0: set(ax,'XTickLabel',ti); tomwalters@0: if turn_axis_vertically==1 tomwalters@0: set(ax,'YTickLabel',[]); tomwalters@0: set(ax,'XAxisLocation','top'); tomwalters@0: end tomwalters@0: