I\'m looking for a C# .NET library for digital filtering (lowpass, highpass, notch) to filter ECG waveforms in real-time. Any suggestions?
If this is non commercial use, I have heard good things about the Signal Lab library. It is free for non commercial use, $570 for commercial use. It it a bit overkill if you are just needing low pass, high pass, and band pass filters. but it does come with controls for visualizing the data if you do not have any yet.
If you just need the filters you may just want to write your own code for the 3 filters. You can check the wikipedia pages for psudocode examples of a Low-pass filter and High-pass filter, I did not quickly find a code example of a noch filter.
Here are some C examples of various filters, to help give you a clue on what you need to do.
If your data is arriving in discrete chunks, I would use Reactive Extensions. This allows the input to control what happens next (reacting to data) instead of using "pull" operations. You can then react to this data by passing it through filters, and then react to that data by displaying it or performing additional calculations.
If you only need notch, high, and low filters, these are trivial to write. As each chunk of data arrives, you can decide whether or not to pass it to the next step (or whether or not to modify the data first). I would imagine you could write this whole section of code in less than 20 lines (maybe less than 10) using Rx. It would result in some pretty elegant code for this use case.
As far as I know you can write your own, because I did.
This should be a good starter for you (coded in C++ but you can easily covert the syntax to C#) - http://www.codeproject.com/KB/cpp/ecg_dsp.aspx
Third party libraries wouldn't be very flexible on the filter equation parameters. As you only will know the characteristics of your signal (amplitudes, frequency band and sampling etc.)
I recommend using a waveshaping algorithm first to get a smooth signal on the C# side before you apply filters, if your ECG sampling rate is low.