I'm interested in creating a decimation filter to go in the middle of the BCI2000 filter chain, such that early filters can operate at one sampling rate and later filters can operate at another.
Is this possible? My understanding is that filters need to create an output sample for each input sample, which a decimation filter would not do.
Decimation Filter
-
gschalk
- Posts: 615
- Joined: 28 Jan 2003, 12:37
decimation
Hi,
Each filter in the filter chain takes an input signal and transforms it into an output signal. The output signal can have a different dimensionality (i.e., # channels or samples) than the input signal. Signal properties are defined in the Preflight() function using the SignalProperties operator. See
http://www.bci2000.org/wiki/index.php/P ... ion_Module
for an example.
Gerv
Each filter in the filter chain takes an input signal and transforms it into an output signal. The output signal can have a different dimensionality (i.e., # channels or samples) than the input signal. Signal properties are defined in the Preflight() function using the SignalProperties operator. See
http://www.bci2000.org/wiki/index.php/P ... ion_Module
for an example.
Gerv
-
chazzd13
- Posts: 14
- Joined: 12 May 2010, 03:51
Re: Decimation Filter
Greetings.
I am also trying to implement a decimation filter for the mu rhythm BCI. However, it seems that later filters (e.g. ARFilter and LinearClassifier) query the initial SamplingRate and SampleBlockSize. Are there other dependencies or possible hurdles I should be aware of? Any help you can provide in getting this to work would be greatly appreciated.
Sincerely,
Charles
I am also trying to implement a decimation filter for the mu rhythm BCI. However, it seems that later filters (e.g. ARFilter and LinearClassifier) query the initial SamplingRate and SampleBlockSize. Are there other dependencies or possible hurdles I should be aware of? Any help you can provide in getting this to work would be greatly appreciated.
Sincerely,
Charles
-
mellinger
- Posts: 1341
- Joined: 12 Feb 2003, 11:06
Re: Decimation Filter
Hi,
since a few source code revisions back, filters do no longer query the original sampling rate. Rather, sampling rate is now a read-only property of the SignalProperties class (http://www.bci2000.org/wiki/index.php/P ... ties_Class), and may be manipulated from the GenericFilter::Preflight() and GenericFilter::Initialize() member functions of your filter.
To indicate that decimation by a factor decimationFactor has happened, use the following code in your decimation filter's Preflight() function:
You also need to take care that the decimation factor evenly divides the input's number of elements, e.g. by using an appropriate PreflightCondition() statement.
As you know, you will need to low-pass filter your data before decimating it in order to avoid subsampling artifacts. BCI2000 contains an IIRFilter base class, and a FilterDesign class that makes it easy to implement such a filter. For an example, see src/shared/modules/signalsource/SourceFilter.
Best regards,
Juergen
since a few source code revisions back, filters do no longer query the original sampling rate. Rather, sampling rate is now a read-only property of the SignalProperties class (http://www.bci2000.org/wiki/index.php/P ... ties_Class), and may be manipulated from the GenericFilter::Preflight() and GenericFilter::Initialize() member functions of your filter.
To indicate that decimation by a factor decimationFactor has happened, use the following code in your decimation filter's Preflight() function:
Code: Select all
Output = Input;
Output.SetElements( Input.Elements() / decimationFactor );
Output.ElementUnit().SetGain( Input.ElementUnit().Gain() * decimationFactor );
As you know, you will need to low-pass filter your data before decimating it in order to avoid subsampling artifacts. BCI2000 contains an IIRFilter base class, and a FilterDesign class that makes it easy to implement such a filter. For an example, see src/shared/modules/signalsource/SourceFilter.
Best regards,
Juergen
-
chazzd13
- Posts: 14
- Joined: 12 May 2010, 03:51
Re: Decimation Filter
Thank you so much, Juergen. I will update my code to the latest revision and try that out.
Who is online
Users browsing this forum: No registered users and 0 guests
