Class FilterViewModel

ViewModel for FilterBlock with dynamic parameter control. Includes ScopeMonitor, SpiderMonitor, and HeatMap for filtered output visualization.

Threading:

  • Block events (PropertyChanged, OnPublish, OnParametersChanged) may fire on background threads
  • ObservableProperty supplies notifications, not processing synchronization. The model applies settings under its processing lock.
  • Avalonia marshals bound property updates; collection or control changes still require the UI thread.
Inheritance
FilterViewModel
Namespace: MOSAIC.ViewModels.SignalProcessing
Assembly: MOSAIC.dll
Syntax
public class FilterViewModel : ObservableObject, INotifyPropertyChanged, INotifyPropertyChanging, IDisposable

Constructors

FilterViewModel(Filter)

Declaration
public FilterViewModel(Filter block)
Parameters
Type Name Description
Filter block

Fields

_block

Declaration
private readonly Filter _block
Field Value
Type Description
Filter

_cutoffHigh

Declaration
[ObservableProperty]
private double _cutoffHigh
Field Value
Type Description
double

_cutoffLow

Declaration
[ObservableProperty]
private double _cutoffLow
Field Value
Type Description
double

_disposed

Declaration
private bool _disposed
Field Value
Type Description
bool

_filterDescription

Declaration
[ObservableProperty]
private string _filterDescription
Field Value
Type Description
string

_firTaps

Declaration
[ObservableProperty]
private int _firTaps
Field Value
Type Description
int

_isEnabled

Declaration
[ObservableProperty]
private bool _isEnabled
Field Value
Type Description
bool

_order

Declaration
[ObservableProperty]
private int _order
Field Value
Type Description
int

_samplesProcessed

Declaration
[ObservableProperty]
private long _samplesProcessed
Field Value
Type Description
long

_selectedFilterType

Declaration
[ObservableProperty]
[NotifyPropertyChangedFor("IsBandFilter")]
private FilterType _selectedFilterType
Field Value
Type Description
FilterType

_selectedImplementation

Declaration
[ObservableProperty]
private FilterImplementation _selectedImplementation
Field Value
Type Description
FilterImplementation

applyChangesCommand

The backing field for ApplyChangesCommand.

Declaration
private RelayCommand? applyChangesCommand
Field Value
Type Description
RelayCommand

resetFiltersCommand

The backing field for ResetFiltersCommand.

Declaration
private RelayCommand? resetFiltersCommand
Field Value
Type Description
RelayCommand

setBandpassCommand

The backing field for SetBandpassCommand.

Declaration
private RelayCommand? setBandpassCommand
Field Value
Type Description
RelayCommand

setBandstopCommand

The backing field for SetBandstopCommand.

Declaration
private RelayCommand? setBandstopCommand
Field Value
Type Description
RelayCommand

setHighpassCommand

The backing field for SetHighpassCommand.

Declaration
private RelayCommand? setHighpassCommand
Field Value
Type Description
RelayCommand

setLowpassCommand

The backing field for SetLowpassCommand.

Declaration
private RelayCommand? setLowpassCommand
Field Value
Type Description
RelayCommand

setPreset100HzCommand

The backing field for SetPreset100HzCommand.

Declaration
private RelayCommand? setPreset100HzCommand
Field Value
Type Description
RelayCommand

setPreset200HzCommand

The backing field for SetPreset200HzCommand.

Declaration
private RelayCommand? setPreset200HzCommand
Field Value
Type Description
RelayCommand

setPreset50HzCommand

The backing field for SetPreset50HzCommand.

Declaration
private RelayCommand? setPreset50HzCommand
Field Value
Type Description
RelayCommand

setPresetEEGCommand

The backing field for SetPresetEEGCommand.

Declaration
private RelayCommand? setPresetEEGCommand
Field Value
Type Description
RelayCommand

setPresetEMGCommand

The backing field for SetPresetEMGCommand.

Declaration
private RelayCommand? setPresetEMGCommand
Field Value
Type Description
RelayCommand

setPresetNotch50HzCommand

The backing field for SetPresetNotch50HzCommand.

Declaration
private RelayCommand? setPresetNotch50HzCommand
Field Value
Type Description
RelayCommand

setPresetNotch60HzCommand

The backing field for SetPresetNotch60HzCommand.

Declaration
private RelayCommand? setPresetNotch60HzCommand
Field Value
Type Description
RelayCommand

Properties

ApplyChangesCommand

Gets an IRelayCommand instance wrapping ApplyChanges().

Declaration
[ExcludeFromCodeCoverage]
public IRelayCommand ApplyChangesCommand { get; }
Property Value
Type Description
IRelayCommand

AvailableFilterTypes

Declaration
public List<FilterType> AvailableFilterTypes { get; }
Property Value
Type Description
List<FilterType>

AvailableImplementations

Declaration
public List<FilterImplementation> AvailableImplementations { get; }
Property Value
Type Description
List<FilterImplementation>

Block

Declaration
public Filter Block { get; }
Property Value
Type Description
Filter

BlockStatus

Declaration
public BlockStatus BlockStatus { get; }
Property Value
Type Description
BlockStatus

CutoffHigh

Declaration
[ExcludeFromCodeCoverage]
public double CutoffHigh { get; set; }
Property Value
Type Description
double

CutoffLow

Declaration
[ExcludeFromCodeCoverage]
public double CutoffLow { get; set; }
Property Value
Type Description
double

FilterDescription

Declaration
[ExcludeFromCodeCoverage]
public string FilterDescription { get; set; }
Property Value
Type Description
string

FirTaps

Declaration
[ExcludeFromCodeCoverage]
public int FirTaps { get; set; }
Property Value
Type Description
int

FrequencyText

Declaration
public string FrequencyText { get; }
Property Value
Type Description
string

IsBandFilter

Declaration
public bool IsBandFilter { get; }
Property Value
Type Description
bool

IsEnabled

Declaration
[ExcludeFromCodeCoverage]
public bool IsEnabled { get; set; }
Property Value
Type Description
bool

IsFirFilter

Declaration
public bool IsFirFilter { get; }
Property Value
Type Description
bool

MaxCutoff

Declaration
public double MaxCutoff { get; }
Property Value
Type Description
double

MinCutoff

Declaration
public double MinCutoff { get; }
Property Value
Type Description
double

Name

Declaration
public string Name { get; }
Property Value
Type Description
string

Order

Declaration
[ExcludeFromCodeCoverage]
public int Order { get; set; }
Property Value
Type Description
int

ResetFiltersCommand

Gets an IRelayCommand instance wrapping ResetFilters().

Declaration
[ExcludeFromCodeCoverage]
public IRelayCommand ResetFiltersCommand { get; }
Property Value
Type Description
IRelayCommand

SampleRate

Declaration
public double SampleRate { get; }
Property Value
Type Description
double

SamplesProcessed

Declaration
[ExcludeFromCodeCoverage]
public long SamplesProcessed { get; set; }
Property Value
Type Description
long

SelectedFilterType

Declaration
[ExcludeFromCodeCoverage]
public FilterType SelectedFilterType { get; set; }
Property Value
Type Description
FilterType

SelectedImplementation

Declaration
[ExcludeFromCodeCoverage]
public FilterImplementation SelectedImplementation { get; set; }
Property Value
Type Description
FilterImplementation

SetBandpassCommand

Gets an IRelayCommand instance wrapping SetBandpass().

Declaration
[ExcludeFromCodeCoverage]
public IRelayCommand SetBandpassCommand { get; }
Property Value
Type Description
IRelayCommand

SetBandstopCommand

Gets an IRelayCommand instance wrapping SetBandstop().

Declaration
[ExcludeFromCodeCoverage]
public IRelayCommand SetBandstopCommand { get; }
Property Value
Type Description
IRelayCommand

SetHighpassCommand

Gets an IRelayCommand instance wrapping SetHighpass().

Declaration
[ExcludeFromCodeCoverage]
public IRelayCommand SetHighpassCommand { get; }
Property Value
Type Description
IRelayCommand

SetLowpassCommand

Gets an IRelayCommand instance wrapping SetLowpass().

Declaration
[ExcludeFromCodeCoverage]
public IRelayCommand SetLowpassCommand { get; }
Property Value
Type Description
IRelayCommand

SetPreset100HzCommand

Gets an IRelayCommand instance wrapping SetPreset100Hz().

Declaration
[ExcludeFromCodeCoverage]
public IRelayCommand SetPreset100HzCommand { get; }
Property Value
Type Description
IRelayCommand

SetPreset200HzCommand

Gets an IRelayCommand instance wrapping SetPreset200Hz().

Declaration
[ExcludeFromCodeCoverage]
public IRelayCommand SetPreset200HzCommand { get; }
Property Value
Type Description
IRelayCommand

SetPreset50HzCommand

Gets an IRelayCommand instance wrapping SetPreset50Hz().

Declaration
[ExcludeFromCodeCoverage]
public IRelayCommand SetPreset50HzCommand { get; }
Property Value
Type Description
IRelayCommand

SetPresetEEGCommand

Gets an IRelayCommand instance wrapping SetPresetEEG().

Declaration
[ExcludeFromCodeCoverage]
public IRelayCommand SetPresetEEGCommand { get; }
Property Value
Type Description
IRelayCommand

SetPresetEMGCommand

Gets an IRelayCommand instance wrapping SetPresetEMG().

Declaration
[ExcludeFromCodeCoverage]
public IRelayCommand SetPresetEMGCommand { get; }
Property Value
Type Description
IRelayCommand

SetPresetNotch50HzCommand

Gets an IRelayCommand instance wrapping SetPresetNotch50Hz().

Declaration
[ExcludeFromCodeCoverage]
public IRelayCommand SetPresetNotch50HzCommand { get; }
Property Value
Type Description
IRelayCommand

SetPresetNotch60HzCommand

Gets an IRelayCommand instance wrapping SetPresetNotch60Hz().

Declaration
[ExcludeFromCodeCoverage]
public IRelayCommand SetPresetNotch60HzCommand { get; }
Property Value
Type Description
IRelayCommand

Methods

ApplyChanges()

Declaration
[RelayCommand]
private void ApplyChanges()

Block_PropertyChanged(object?, PropertyChangedEventArgs)

Handles property changes from the block.

Declaration
private void Block_PropertyChanged(object? sender, PropertyChangedEventArgs e)
Parameters
Type Name Description
object sender
PropertyChangedEventArgs e

ClampCutoffsToValidRange()

Declaration
private void ClampCutoffsToValidRange()

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

Declaration
public void Dispose()

HandleFilterOutput(object)

Handles filtered output data for visualization. Called on processing thread — all monitors' enqueue methods are thread-safe.

Declaration
private void HandleFilterOutput(object data)
Parameters
Type Name Description
object data

HandleParametersChanged(FilterType, FilterImplementation, double, double, int)

Declaration
private void HandleParametersChanged(FilterType type, FilterImplementation impl, double low, double high, int order)
Parameters
Type Name Description
FilterType type
FilterImplementation impl
double low
double high
int order

OnCutoffHighChanged(double)

Executes the logic for when CutoffHigh just changed.

Declaration
private void OnCutoffHighChanged(double value)
Parameters
Type Name Description
double value

The new property value that was set.

Remarks

This method is invoked right after the value of CutoffHigh is changed.

OnCutoffHighChanged(double, double)

Executes the logic for when CutoffHigh just changed.

Declaration
private void OnCutoffHighChanged(double oldValue, double newValue)
Parameters
Type Name Description
double oldValue

The previous property value that was replaced.

double newValue

The new property value that was set.

Remarks

This method is invoked right after the value of CutoffHigh is changed.

OnCutoffHighChanging(double)

Executes the logic for when CutoffHigh is changing.

Declaration
private void OnCutoffHighChanging(double value)
Parameters
Type Name Description
double value

The new property value being set.

Remarks

This method is invoked right before the value of CutoffHigh is changed.

OnCutoffHighChanging(double, double)

Executes the logic for when CutoffHigh is changing.

Declaration
private void OnCutoffHighChanging(double oldValue, double newValue)
Parameters
Type Name Description
double oldValue

The previous property value that is being replaced.

double newValue

The new property value being set.

Remarks

This method is invoked right before the value of CutoffHigh is changed.

OnCutoffLowChanged(double)

Executes the logic for when CutoffLow just changed.

Declaration
private void OnCutoffLowChanged(double value)
Parameters
Type Name Description
double value

The new property value that was set.

Remarks

This method is invoked right after the value of CutoffLow is changed.

OnCutoffLowChanged(double, double)

Executes the logic for when CutoffLow just changed.

Declaration
private void OnCutoffLowChanged(double oldValue, double newValue)
Parameters
Type Name Description
double oldValue

The previous property value that was replaced.

double newValue

The new property value that was set.

Remarks

This method is invoked right after the value of CutoffLow is changed.

OnCutoffLowChanging(double)

Executes the logic for when CutoffLow is changing.

Declaration
private void OnCutoffLowChanging(double value)
Parameters
Type Name Description
double value

The new property value being set.

Remarks

This method is invoked right before the value of CutoffLow is changed.

OnCutoffLowChanging(double, double)

Executes the logic for when CutoffLow is changing.

Declaration
private void OnCutoffLowChanging(double oldValue, double newValue)
Parameters
Type Name Description
double oldValue

The previous property value that is being replaced.

double newValue

The new property value being set.

Remarks

This method is invoked right before the value of CutoffLow is changed.

OnFilterDescriptionChanged(string)

Executes the logic for when FilterDescription just changed.

Declaration
private void OnFilterDescriptionChanged(string value)
Parameters
Type Name Description
string value

The new property value that was set.

Remarks

This method is invoked right after the value of FilterDescription is changed.

OnFilterDescriptionChanged(string?, string)

Executes the logic for when FilterDescription just changed.

Declaration
private void OnFilterDescriptionChanged(string? oldValue, string newValue)
Parameters
Type Name Description
string oldValue

The previous property value that was replaced.

string newValue

The new property value that was set.

Remarks

This method is invoked right after the value of FilterDescription is changed.

OnFilterDescriptionChanging(string)

Executes the logic for when FilterDescription is changing.

Declaration
private void OnFilterDescriptionChanging(string value)
Parameters
Type Name Description
string value

The new property value being set.

Remarks

This method is invoked right before the value of FilterDescription is changed.

OnFilterDescriptionChanging(string?, string)

Executes the logic for when FilterDescription is changing.

Declaration
private void OnFilterDescriptionChanging(string? oldValue, string newValue)
Parameters
Type Name Description
string oldValue

The previous property value that is being replaced.

string newValue

The new property value being set.

Remarks

This method is invoked right before the value of FilterDescription is changed.

OnFirTapsChanged(int)

Executes the logic for when FirTaps just changed.

Declaration
private void OnFirTapsChanged(int value)
Parameters
Type Name Description
int value

The new property value that was set.

Remarks

This method is invoked right after the value of FirTaps is changed.

OnFirTapsChanged(int, int)

Executes the logic for when FirTaps just changed.

Declaration
private void OnFirTapsChanged(int oldValue, int newValue)
Parameters
Type Name Description
int oldValue

The previous property value that was replaced.

int newValue

The new property value that was set.

Remarks

This method is invoked right after the value of FirTaps is changed.

OnFirTapsChanging(int)

Executes the logic for when FirTaps is changing.

Declaration
private void OnFirTapsChanging(int value)
Parameters
Type Name Description
int value

The new property value being set.

Remarks

This method is invoked right before the value of FirTaps is changed.

OnFirTapsChanging(int, int)

Executes the logic for when FirTaps is changing.

Declaration
private void OnFirTapsChanging(int oldValue, int newValue)
Parameters
Type Name Description
int oldValue

The previous property value that is being replaced.

int newValue

The new property value being set.

Remarks

This method is invoked right before the value of FirTaps is changed.

OnIsEnabledChanged(bool)

Executes the logic for when IsEnabled just changed.

Declaration
private void OnIsEnabledChanged(bool value)
Parameters
Type Name Description
bool value

The new property value that was set.

Remarks

This method is invoked right after the value of IsEnabled is changed.

OnIsEnabledChanged(bool, bool)

Executes the logic for when IsEnabled just changed.

Declaration
private void OnIsEnabledChanged(bool oldValue, bool newValue)
Parameters
Type Name Description
bool oldValue

The previous property value that was replaced.

bool newValue

The new property value that was set.

Remarks

This method is invoked right after the value of IsEnabled is changed.

OnIsEnabledChanging(bool)

Executes the logic for when IsEnabled is changing.

Declaration
private void OnIsEnabledChanging(bool value)
Parameters
Type Name Description
bool value

The new property value being set.

Remarks

This method is invoked right before the value of IsEnabled is changed.

OnIsEnabledChanging(bool, bool)

Executes the logic for when IsEnabled is changing.

Declaration
private void OnIsEnabledChanging(bool oldValue, bool newValue)
Parameters
Type Name Description
bool oldValue

The previous property value that is being replaced.

bool newValue

The new property value being set.

Remarks

This method is invoked right before the value of IsEnabled is changed.

OnOrderChanged(int)

Executes the logic for when Order just changed.

Declaration
private void OnOrderChanged(int value)
Parameters
Type Name Description
int value

The new property value that was set.

Remarks

This method is invoked right after the value of Order is changed.

OnOrderChanged(int, int)

Executes the logic for when Order just changed.

Declaration
private void OnOrderChanged(int oldValue, int newValue)
Parameters
Type Name Description
int oldValue

The previous property value that was replaced.

int newValue

The new property value that was set.

Remarks

This method is invoked right after the value of Order is changed.

OnOrderChanging(int)

Executes the logic for when Order is changing.

Declaration
private void OnOrderChanging(int value)
Parameters
Type Name Description
int value

The new property value being set.

Remarks

This method is invoked right before the value of Order is changed.

OnOrderChanging(int, int)

Executes the logic for when Order is changing.

Declaration
private void OnOrderChanging(int oldValue, int newValue)
Parameters
Type Name Description
int oldValue

The previous property value that is being replaced.

int newValue

The new property value being set.

Remarks

This method is invoked right before the value of Order is changed.

OnSamplesProcessedChanged(long)

Executes the logic for when SamplesProcessed just changed.

Declaration
private void OnSamplesProcessedChanged(long value)
Parameters
Type Name Description
long value

The new property value that was set.

Remarks

This method is invoked right after the value of SamplesProcessed is changed.

OnSamplesProcessedChanged(long, long)

Executes the logic for when SamplesProcessed just changed.

Declaration
private void OnSamplesProcessedChanged(long oldValue, long newValue)
Parameters
Type Name Description
long oldValue

The previous property value that was replaced.

long newValue

The new property value that was set.

Remarks

This method is invoked right after the value of SamplesProcessed is changed.

OnSamplesProcessedChanging(long)

Executes the logic for when SamplesProcessed is changing.

Declaration
private void OnSamplesProcessedChanging(long value)
Parameters
Type Name Description
long value

The new property value being set.

Remarks

This method is invoked right before the value of SamplesProcessed is changed.

OnSamplesProcessedChanging(long, long)

Executes the logic for when SamplesProcessed is changing.

Declaration
private void OnSamplesProcessedChanging(long oldValue, long newValue)
Parameters
Type Name Description
long oldValue

The previous property value that is being replaced.

long newValue

The new property value being set.

Remarks

This method is invoked right before the value of SamplesProcessed is changed.

OnSelectedFilterTypeChanged(FilterType)

Executes the logic for when SelectedFilterType just changed.

Declaration
private void OnSelectedFilterTypeChanged(FilterType value)
Parameters
Type Name Description
FilterType value

The new property value that was set.

Remarks

This method is invoked right after the value of SelectedFilterType is changed.

OnSelectedFilterTypeChanged(FilterType, FilterType)

Executes the logic for when SelectedFilterType just changed.

Declaration
private void OnSelectedFilterTypeChanged(FilterType oldValue, FilterType newValue)
Parameters
Type Name Description
FilterType oldValue

The previous property value that was replaced.

FilterType newValue

The new property value that was set.

Remarks

This method is invoked right after the value of SelectedFilterType is changed.

OnSelectedFilterTypeChanging(FilterType)

Executes the logic for when SelectedFilterType is changing.

Declaration
private void OnSelectedFilterTypeChanging(FilterType value)
Parameters
Type Name Description
FilterType value

The new property value being set.

Remarks

This method is invoked right before the value of SelectedFilterType is changed.

OnSelectedFilterTypeChanging(FilterType, FilterType)

Executes the logic for when SelectedFilterType is changing.

Declaration
private void OnSelectedFilterTypeChanging(FilterType oldValue, FilterType newValue)
Parameters
Type Name Description
FilterType oldValue

The previous property value that is being replaced.

FilterType newValue

The new property value being set.

Remarks

This method is invoked right before the value of SelectedFilterType is changed.

OnSelectedImplementationChanged(FilterImplementation)

Executes the logic for when SelectedImplementation just changed.

Declaration
private void OnSelectedImplementationChanged(FilterImplementation value)
Parameters
Type Name Description
FilterImplementation value

The new property value that was set.

Remarks

This method is invoked right after the value of SelectedImplementation is changed.

OnSelectedImplementationChanged(FilterImplementation, FilterImplementation)

Executes the logic for when SelectedImplementation just changed.

Declaration
private void OnSelectedImplementationChanged(FilterImplementation oldValue, FilterImplementation newValue)
Parameters
Type Name Description
FilterImplementation oldValue

The previous property value that was replaced.

FilterImplementation newValue

The new property value that was set.

Remarks

This method is invoked right after the value of SelectedImplementation is changed.

OnSelectedImplementationChanging(FilterImplementation)

Executes the logic for when SelectedImplementation is changing.

Declaration
private void OnSelectedImplementationChanging(FilterImplementation value)
Parameters
Type Name Description
FilterImplementation value

The new property value being set.

Remarks

This method is invoked right before the value of SelectedImplementation is changed.

OnSelectedImplementationChanging(FilterImplementation, FilterImplementation)

Executes the logic for when SelectedImplementation is changing.

Declaration
private void OnSelectedImplementationChanging(FilterImplementation oldValue, FilterImplementation newValue)
Parameters
Type Name Description
FilterImplementation oldValue

The previous property value that is being replaced.

FilterImplementation newValue

The new property value being set.

Remarks

This method is invoked right before the value of SelectedImplementation is changed.

ResetFilters()

Declaration
[RelayCommand]
private void ResetFilters()

SetBandpass()

Declaration
[RelayCommand]
private void SetBandpass()

SetBandstop()

Declaration
[RelayCommand]
private void SetBandstop()

SetHighpass()

Declaration
[RelayCommand]
private void SetHighpass()

SetLowpass()

Declaration
[RelayCommand]
private void SetLowpass()

SetPreset100Hz()

Declaration
[RelayCommand]
private void SetPreset100Hz()

SetPreset200Hz()

Declaration
[RelayCommand]
private void SetPreset200Hz()

SetPreset50Hz()

Declaration
[RelayCommand]
private void SetPreset50Hz()

SetPresetEEG()

Declaration
[RelayCommand]
private void SetPresetEEG()

SetPresetEMG()

Declaration
[RelayCommand]
private void SetPresetEMG()

SetPresetNotch50Hz()

Declaration
[RelayCommand]
private void SetPresetNotch50Hz()

SetPresetNotch60Hz()

Declaration
[RelayCommand]
private void SetPresetNotch60Hz()

Implements

INotifyPropertyChanged
INotifyPropertyChanging
IDisposable

Search documentation

Start typing to search the documentation.