Skip to content

Commit f14f3f1

Browse files
committed
Merge pull request #23 from breznak/ciic_2016_challenge
[WIP] CiiC 2016 challenge
2 parents c81cb4a + 52ebc06 commit f14f3f1

File tree

94 files changed

+9896
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

94 files changed

+9896
-0
lines changed

Diff for: CinC2016Challenge_PCG/.gitignore

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
## for CinC PCG Challenge
2+
#ignore train data
3+
./data/training-*
4+
# trained OPF models
5+
examples/nupic2016/model/savedmodels/

Diff for: CinC2016Challenge_PCG/README.md

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# CinC/Physionet 2016 Challenge = PCG (audio) ECG anomaly classification.
2+
3+
Categories: `normal/dunno/anomaly`.
4+
5+
https://physionet.org/challenge/2016/
6+
7+
## Data
8+
9+
Download [training dataset](https://physionet.org/physiobank/database/challenge/2016/training.zip) and extract it in `data/`
10+
11+
## Develop
12+
13+
The project is worked on in `examples/nupic2016/`

Diff for: CinC2016Challenge_PCG/examples/nupic2016/AUTHORS.txt

Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
% function [hilbert_envelope] = Hilbert_Envelope(input_signal, sampling_frequency,figures)
2+
%
3+
% This function finds the Hilbert envelope of a signal. This is taken from:
4+
%
5+
% Choi et al, Comparison of envelope extraction algorithms for cardiac sound
6+
% signal segmentation, Expert Systems with Applications, 2008
7+
%
8+
%% Inputs:
9+
% input_signal: the original signal
10+
% samplingFrequency: the signal's sampling frequency
11+
% figures: (optional) boolean variable to display a figure of both the
12+
% original and normalised signal
13+
%
14+
%% Outputs:
15+
% hilbert_envelope is the hilbert envelope of the original signal
16+
%
17+
% This code was developed by David Springer for comparison purposes in the
18+
% paper:
19+
% D. Springer et al., "Logistic Regression-HSMM-based Heart Sound
20+
% Segmentation," IEEE Trans. Biomed. Eng., In Press, 2015.
21+
%
22+
%% Copyright (C) 2016 David Springer
23+
24+
%
25+
% This program is free software: you can redistribute it and/or modify
26+
% it under the terms of the GNU General Public License as published by
27+
% the Free Software Foundation, either version 3 of the License, or
28+
% any later version.
29+
%
30+
% This program is distributed in the hope that it will be useful,
31+
% but WITHOUT ANY WARRANTY; without even the implied warranty of
32+
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
33+
% GNU General Public License for more details.
34+
%
35+
% You should have received a copy of the GNU General Public License
36+
% along with this program. If not, see <http://www.gnu.org/licenses/>.
37+
38+
function hilbert_envelope = Hilbert_Envelope(input_signal, sampling_frequency,figures)
39+
40+
if nargin <3,
41+
figures = 0;
42+
end
43+
44+
45+
hilbert_envelope = abs(hilbert(input_signal)); %find the envelope of the signal using the Hilbert transform
46+
47+
if(figures)
48+
figure('Name', 'Hilbert Envelope');
49+
plot(input_signal');
50+
hold on;
51+
plot(hilbert_envelope,'r');
52+
legend('Original Signal','Hilbert Envelope');
53+
pause();
54+
end
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
% function homomorphic_envelope = Homomorphic_Envelope_with_Hilbert(input_signal, sampling_frequency,lpf_frequency,figures)
2+
%
3+
% This function finds the homomorphic envelope of a signal, using the method
4+
% described in the following publications:
5+
%
6+
% S. E. Schmidt et al., ?Segmentation of heart sound recordings by a
7+
% duration-dependent hidden Markov model.,? Physiol. Meas., vol. 31, no. 4,
8+
% pp. 513?29, Apr. 2010.
9+
%
10+
% C. Gupta et al., ?Neural network classification of homomorphic segmented
11+
% heart sounds,? Appl. Soft Comput., vol. 7, no. 1, pp. 286?297, Jan. 2007.
12+
%
13+
% D. Gill et al., ?Detection and identification of heart sounds using
14+
% homomorphic envelogram and self-organizing probabilistic model,? in
15+
% Computers in Cardiology, 2005, pp. 957?960.
16+
% (However, these researchers found the homomorphic envelope of shannon
17+
% energy.)
18+
%
19+
% In I. Rezek and S. Roberts, ?Envelope Extraction via Complex Homomorphic
20+
% Filtering. Technical Report TR-98-9,? London, 1998, the researchers state
21+
% that the singularity at 0 when using the natural logarithm (resulting in
22+
% values of -inf) can be fixed by using a complex valued signal. They
23+
% motivate the use of the Hilbert transform to find the analytic signal,
24+
% which is a converstion of a real-valued signal to a complex-valued
25+
% signal, which is unaffected by the singularity.
26+
%
27+
% A zero-phase low-pass Butterworth filter is used to extract the envelope.
28+
%% Inputs:
29+
% input_signal: the original signal (1D) signal
30+
% samplingFrequency: the signal's sampling frequency (Hz)
31+
% lpf_frequency: the frequency cut-off of the low-pass filter to be used in
32+
% the envelope extraciton (Default = 8 Hz as in Schmidt's publication).
33+
% figures: (optional) boolean variable dictating the display of a figure of
34+
% both the original signal and the extracted envelope:
35+
%
36+
%% Outputs:
37+
% homomorphic_envelope: The homomorphic envelope of the original
38+
% signal (not normalised).
39+
%
40+
% This code was developed by David Springer for comparison purposes in the
41+
% paper:
42+
% D. Springer et al., ?Logistic Regression-HSMM-based Heart Sound
43+
% Segmentation,? IEEE Trans. Biomed. Eng., In Press, 2015.
44+
%
45+
%% Copyright (C) 2016 David Springer
46+
47+
%
48+
% This program is free software: you can redistribute it and/or modify
49+
% it under the terms of the GNU General Public License as published by
50+
% the Free Software Foundation, either version 3 of the License, or
51+
% any later version.
52+
%
53+
% This program is distributed in the hope that it will be useful,
54+
% but WITHOUT ANY WARRANTY; without even the implied warranty of
55+
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
56+
% GNU General Public License for more details.
57+
%
58+
% You should have received a copy of the GNU General Public License
59+
% along with this program. If not, see <http://www.gnu.org/licenses/>.
60+
61+
function homomorphic_envelope = Homomorphic_Envelope_with_Hilbert(input_signal, sampling_frequency,lpf_frequency,figures)
62+
63+
if nargin <4,
64+
figures = 0;
65+
end
66+
if nargin <3,
67+
figures = 0;
68+
lpf_frequency = 8;
69+
end
70+
71+
%8Hz, 1st order, Butterworth LPF
72+
[B_low,A_low] = butter(1,2*lpf_frequency/sampling_frequency,'low');
73+
homomorphic_envelope = exp(filtfilt(B_low,A_low,log(abs(hilbert(input_signal)))));
74+
75+
% Remove spurious spikes in first sample:
76+
homomorphic_envelope(1) = [homomorphic_envelope(2)];
77+
78+
if(figures)
79+
figure('Name', 'Homomorphic Envelope');
80+
plot(input_signal);
81+
hold on;
82+
plot(homomorphic_envelope,'r');
83+
legend('Original Signal','Homomorphic Envelope')
84+
end

0 commit comments

Comments
 (0)