This is a friendly desktop application project in C# for signal processing, and customized for Electrocardiogram (ECG) signal features extraction and classification.
. Signals comparator (cross-correlation, minimum distance, dynamic time wrapping).
. Filtering tools (Butterworth, Chebychev I, Chebychev II, DC removal, Normalization, Discrete Wavelet Transform, etc.).
. Signal spectrum analyzer.
. Signal peaks analyzer (up peaks, down peaks, stable state, tangent deviation states).
. Customized Machine learning algorithms (Deep Neural Networks, Naive Bayes, K-nearest neighbor) for ECG waves detection.
. A customized tool for data generation (features selection).
. Data analysis (raw visualization, Principal Component Analysis).
For implementing the Tensorflow.NET framework, this application is dependent on .NET 6.0 SDK and Visdual Studio 2022 17.0 or later.
The main form gives access to navigate to "Signal comparator", "Signals collector", "AI tools", and "Signal details/modify" forms. The "Choose File" button opens a file dialog for choosing the signal. The application allows for plotting multiple signals on the same window. Two types of signal files are accepted (".mat", and ".txt") as given in bsp-using-ai/Sample signals/. A window will pop up after selecting the signal for inserting the corresponding sampling rate and quantization step to the chosen signal.
It contains multiple filtering tools and shows its effect on the signal in addition to the spectrum analysis that corresponds to the signal. The section below the horizontal line belongs to our customized data generation for the ECG signals classification (click the blue button named "Set features labels" to start generating data, and after finishing click "Save" in the main form). All the created machine-learning models will be listed in the combo box next to the "Predict" button. Select the desired model and click "Predict" for annotating the signal automatically using the selected model (any changes should be discarded by clicking the red button named "Discard" before starting the prediction).
The figure below shows an example of applying a band pass filter using two separate filters (a high pass and a low pass).
The order of the filters matters as illustrated in the two figures below:
Left-clicking on the filter pops up a menu for deleting the selected filter:
Signal fusion divides the signal into periods of frequency with the highest magnitude and provides multiple operations to perform across the separated periods. The period range is adjustable manually if any auto miss-calculation occurs. The periods can be centralized and stretched concerning the R peak, or even translated with an offset.
The operations apply across all periods. The addition operation takes the samples of all the periods and divides them by the number of periods. It's like creating the mean of the periods.
The multiplication operation is the same as the addition operation but instead of adding the samples, it multiplies the samples.
The cross-correlation operation applies the cross-correlation across all the periods.
The orthogonalization operation applies the Gram–Schmidt orthogonalization between the periods and outputs the result of orthogonal periods named "Psi".
The fuse button next to orthogonalization takes the Psies and performs an addition operation across them.
It accepts two signals for comparison. Ticking the checkboxes named "Select first signal" and "Select second signal" allows for the reception of the signals for comparison. Almost every plot in the application has the option of sending its signal for comparison. Clicking on the plot the first left click pops up the default menu of "ScottPlot", then left-clicking on the plot for the second time popsup the menu for sending the signal for comparison as shown in the figure below:
Three options for comparison are available. The first one is cross-correlation:
The second option is named "Minimum distance". It translates the second signal with the offset of the highest coefficient in cross-correlation, and takes the absolute subtraction of the two signals as "Minimum distance":
The third option of comparison is Dynamic Time Wrapping:
It is an option for gathering different signals close together for better manual visual analysis.
This part is customized only for ECG signals features classification (peaks annotation) using three types of machine learning models (Neural Networks, K-Nearest Neighbors, and Naive Bayes). It also contains data analysis tools (raw data visualization, and Principal Component Analysis) that can be used for other purposes. For creating a new model, the user will have to choose the model type and the problem to solve from the two combo boxes in the top-left corner, then click "Create new model". The button "Dataset explorer" opens the form for listing the previously generated saved data. The button "Fit" opens the form for choosing the training data for the model.
It displays the training data and validation information of the model. It also allows for changing the decision thresholds of the classification models. Any changes applied to the decision thresholds can be saved by clicking the "Save changes" button. Clicking on any of the seven sub-models opens the form of data analysis of the selected sub-model.
The raw data visualization differs from coloring the data points in the scatter-plot linearly for models solving regression problems to associating each class with a unique color for models solving classification problems as shown in the two figures below respectively.
The Principal Component Analysis tab displays the Eigenvalues of the training dataset in a histogram. Clicking on any bar in the histogram displays the coefficients of the corresponding Eigenvector.