Next: MRGANN(1) Up: WFDB Applications Guide Previous: MEMSE(1)On This Page

Name

mfilt - general-purpose median filter for WFDB records

Synopsis

mfilt -l length [ options ... ]

Description

mfilt can be used to apply a median filter of any desired length to any desired section of a database record. The length is expressed in samples (i.e., each output sample is the median of length input samples). Median filters can be much more effective than any type of linear filter for removing impulse noise from signals; they are not particularly useful for removing persistent noise, however. Generally, the shortest effective median filter is the one that should be used, to minimize the aliasing effects resulting from the non-linear characteristics of the filter.

Options are:

-f time
Filter from the specified time on the input record (default: start at the beginning of the record).
-h
Print a usage summary.
-H
Read the signal files in high-resolution mode (default: standard mode). These modes are identical for ordinary records. For multifrequency records, the standard decimation of oversampled signals to the frame rate is suppressed in high-resolution mode (rather, all other signals are resampled at the highest sampling frequency).
-i record
Use the specified record for input (default: record 16).
-l n
Use an n-point median.
-n record
Write the output signals to record.dat, using the same specifications as the input signals, and create a header file for the specified record. This option overrides -o if both are used.
-o record
Use the specified record for output (default: record 16). If the output record header file specifies fewer signals than are present in the input, any extra input signals are discarded.
-t time
Filter until the specified time on the input record (default: go to the end of the record).

In the present implementation, the same filter is applied to each input signal. For each output sample, an array of length input samples centered on the time of interest is sorted. (More efficient algorithms for finding the median exist, especially for large odd values of length; see, for example, Numerical Recipes.) If length is odd, the output is the middle value from the sorted array and there is no phase shift; otherwise, the output is the average of the two middle values from the array and there is a phase shift of one-half of the sampling interval. If necessary, the output is padded at the end to obtain equal numbers of input and output samples.

Environment

It may be necessary to set and export the shell variable WFDB (see setwfdb(1) ).

Example

A 3-point median filter, applied to the first 5 minutes of record 100 to produce a new record 100m:
   mfilt -l 3 -i 100 -n 100m

See Also

fir(1)

Author

George B. Moody (george@mit.edu)

Source

http://www.physionet.org/physiotools/wfdb/app/mfilt.c


Table of Contents

Up: WFDB Applications Guide


Please e-mail your comments and suggestions to webmaster@physionet.org, or post them to:

PhysioNet
MIT Room E25-505A
77 Massachusetts Avenue
Cambridge, MA 02139 USA

Updated 10 June 2022