annotate aim-mat/modules/usermodule/sst/gen_sst.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 % Function to calculate the size-shape image (SSI)
tomwalters@0 2 %
tomwalters@0 3 % (c) 2003-2008, University of Cambridge, Medical Research Council
tomwalters@0 4 %
tomwalters@0 5 % Marc A. Al-Hames
tomwalters@0 6 % April 2003
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 ssi=gen_ssi(sai,options)
tomwalters@0 16
tomwalters@0 17 %user information; open the 'calculation in progress' dialog box
tomwalters@0 18 waithand=waitbar(0,'reading in SAI');
tomwalters@0 19 disp('running the SSI function...');
tomwalters@0 20
tomwalters@0 21 %read in all of the frames in the SAI array - converting them into Irino's
tomwalters@0 22 %3d matrix
tomwalters@0 23
tomwalters@0 24 no_frames=size(sai);
tomwalters@0 25 SAI3d=[];
tomwalters@0 26
tomwalters@0 27 for ii=1:no_frames(2);
tomwalters@0 28 fraction_complete=ii/no_frames(2);
tomwalters@0 29 waitbar(fraction_complete);
tomwalters@0 30 current_frame=sai{ii};
tomwalters@0 31 SAI3d(:,:,ii)=getvalues(current_frame);
tomwalters@0 32 if (options.flipimage == 1)
tomwalters@0 33 SAI3d(:,:,ii) = fliplr(SAI3d(:,:,ii));
tomwalters@0 34 end;
tomwalters@0 35 end;
tomwalters@0 36
tomwalters@0 37 %close the dialog box
tomwalters@0 38 close(waithand);
tomwalters@0 39
tomwalters@0 40 %assume that the sample rate is constant
tomwalters@0 41 sample_rate=getsr(sai{1});
tomwalters@0 42
tomwalters@0 43 SSI3d=Calssi(SAI3d,options,sample_rate);
tomwalters@0 44
tomwalters@0 45 %finally we output everything into frames
tomwalters@0 46 %we have to take the transpose to put it in the correct form for the
tomwalters@0 47 %display function
tomwalters@0 48
tomwalters@0 49 maxfreval=max(max(sum(SSI3d,2)));
tomwalters@0 50
tomwalters@0 51 for jj=1:no_frames(2);
tomwalters@0 52 current_frame=SSI3d(:,:,jj);
tomwalters@0 53 ssi{1,jj}=frame(current_frame);
tomwalters@0 54 %set the sample rate of the frames
tomwalters@0 55 ssi{1,jj}=setsr(ssi{1,jj},sample_rate);
tomwalters@0 56 ssi{1,jj}=setxaxisname(ssi{1,jj},'0');
tomwalters@0 57 ssi{1,jj}=setscalefrequency(ssi{1,jj},maxfreval);
tomwalters@0 58 end;
tomwalters@0 59
tomwalters@0 60
tomwalters@0 61