Rolling ball sifting algorithm for the augmented visual inspection of ...

2 downloads 0 Views 43KB Size Report
auscultation. Adam Huang. 1 ... Augmented Visual Inspection of Carotid Bruit Auscultation" ..... sort triangles (denoted as ABC) so that x-coord: x(A)
Supplementary Information

Rolling ball sifting algorithm for the augmented visual inspection of carotid bruit auscultation

Adam Huang1, Chung-Wei Lee2, Hon-Man Liu2,3,*

1

Research Center for Adaptive Data Analysis, National Central University, Jhongli, 32001, Taiwan 2

Department of Medical Imaging, National Taiwan University Hospital, Taipei, 100, Taiwan 3 Department of Radiology, College of Medicine, National Taiwan University, Taipei, 100, Taiwan *Corresponding author: [email protected]

function DrawFig5(x,y,Fs) % Supplementary Information for the manuscript % "Rolling Ball Sifting Algorithm for the % Augmented Visual Inspection of Carotid Bruit Auscultation" % by Adam Huang, Chung-Wei Lee, Hon-Man Liu* ([email protected]) % submitted to Scientific Reports % input: x input signal's time % y input signal's value % Fs sample frequency % output: augmented visual inspection system as shown in Fig. 5 % code author: Adam Huang, RCADA, National Central University % email: [email protected] % date: 2016/04/08 figure, % % Row1 original carotid sound signal subplot(5,1,1); % plot the input signal on Row 1 plot(x,y,'k');axis tight; % % Row2 heart sound pattern % compute the rolling ball sifting (RBS) envelopes by a large radius % cutoff frequency 5 Hz, rescale factor 50 [~,~,upper,lower]=rcada_rbsift_1(y,Fs,5,50,0); HB=upper-lower; % extracted heart sound pattern subplot(5,1,2); % plot the RBS heart sound pattern on Row 2 plot(x,HB,'r');axis tight; % % Row3 rolling ball sifting bruits % compute the RBS envelopes by a small radius % cutoff frequency 200 Hz, rescale factor 50 IMF1=emd_imf1(y); % extract IMF1 first by the EMD alg. [H200,~,upper,lower]=rcada_rbsift_1(IMF1,Fs,200,50,0); B=upper-lower;% envelope of bruit > 200 Hz subplot(5,1,3); % plot RBS bruits plot(x,H200,'b');axis tight; % % Row4 high pass filtering bruits % compute high pass filtering (HPF) bruits % stopband 150 Hz, passband 250 Hz d = designfilt('highpassiir','StopbandFrequency',150 ,... 'PassbandFrequency',250,'StopbandAttenuation',65, ... 'PassbandRipple',0.5,'SampleRate',Fs,'DesignMethod','butter'); HP200=filter(d,y); subplot(5,1,4); % plot the HPF bruits on Row 4 plot(x,HP200,'g');axis tight; % % Row5 periodicity by autocorrelation [HR]=xcorr(HB,3*Fs,'coeff'); % heart rate by autocorrelation of HB % convolve the RBS bruits' envelope diff by a Hanning window of 0.05 sec RB=conv(B,hann(Fs*0.05),'same'); [RBS]=xcorr(RB,3*Fs,'coeff'); % RBS bruits periodicity % convolve the HPF bruits by a Hanning window of 0.05 sec RHP=conv(abs(HP200),hann(Fs*0.05),'same'); [HPF]=xcorr(RHP,3*Fs,'coeff'); % HPF bruits periodicity h=subplot(5,1,5); % plot the periodicity of HR, RBS, HPF

1

ix=1:length(HR); plot(ix,HR,'r',ix,RBS,'b',ix,HPF,'g');axis tight; h.XTick= [0.7*Fs ,1.8*Fs,2.2*Fs,3*Fs,3.8*Fs,5.2*Fs]; h.XTickLabel={'Heart rate','50' ,'75' ,'x' ,'75' ,'Beats/min'}; function [H,L,upper,lower]=rcada_rbsift_1(y,fs,ft,s,flag) % rolling ball sifting algorithm % input: y signal % fs signal sample frequency % ft threshold (cutoff) frequency % s re-scale factor y=s*y % flag>0 to draw results % output: H high frequency component % L low frequency component % upper envelope % lower envelope % author: Adam Huang, RCADA, National Central University % email: [email protected] % date: 2016/03/17 % % arrange data as a column (m by 1) vector [nrow,ncol]=size(y); if nrow=r); % upper envelope points touched by upper ball radius r iL1=(rL>=r); % lower envelope points touched by lower ball radius r % first and last points are also marked as "touched" iU1(1)=1;iL1(1)=1;iU1(end)=1;iL1(end)=1; % % step 2--inflate and form initial intermittent signal segments iU2=iU1;iL2=iL1; % updated point touching info % local max and min points iMX=((y-[y(1);y(1:end-1)]>=0) & (y-[y(2:end);y(end)]> 0)) |... ((y-[y(1);y(1:end-1)]> 0) & (y-[y(2:end);y(end)]>=0)); iMN=((y-[y(1);y(1:end-1)]iU1); % points touched by lower R-ball but not upper one jj=ii & iMN; % plus condition: local minima [sg0,sg1]=findSegments(ii);% segments touched by lower ball only

2

for i=1:length(sg0) % only keep the local min touched by lower-ball iL2(sg0(i):sg1(i))=jj(sg0(i):sg1(i)); end iL2(1)=1;iL2(end)=1;iU2(1)=1;iU2(end)=1; % % step 3 recover faint local extrema iU3=iU2;iL3=iL2; % updated point touching info iL3(iU2>0 & iMX)=0;... % Eq. (2) % recover touched maxima iU3(iL2>0 & iMN)=0;... % Eq. (3) % recover touched minima iL3(1)=1;iL3(end)=1;iU3(1)=1;iU3(end)=1; % % step 4-- merge fragmental segments iU4=iU3;iL4=iL3; % updated point touching info pflag=0;% peak flag tflag=0;% trough flag for i=2:length(y)-1 if iU3(i)>0 && iL3(i)0 && tflag>0 % merge any peak-trough segment ipeak pflag=0; if x(itrou)-x(ipeak)0)); % piecewise linear upper envelope lower=envlp(x,y,find(iL>0)); % piecewise linear lower envelope plot(x,y,'k','LineWidth',0.5); plot(x,upper,'k','LineWidth',0.75); plot(x,lower,'k','LineWidth',0.75); plot(x,(upper+lower)/2,'k--','LineWidth',0.75); function [imf1]=emd_imf1(y) % emd algorithm % input: y signal % output: imf1 first imf % author: Adam Huang, RCADA, National Central University % email: [email protected] % date: 2016/03/17 % % arrange data as a column (m by 1) vector [nrow,ncol]=size(y); if nrow=0) & (y-[y(2:end);y(end)]> 0)) |... ((y-[y(1);y(1:end-1)]> 0) & (y-[y(2:end);y(end)]>=0)); iMN=((y-[y(1);y(1:end-1)]

Suggest Documents