WFDB Software Package 10.7.0

File: <base>/doc/wag-src/mfilt.1 (3,146 bytes)
.TH MFILT 1 "25 February 2006" "WFDB 10.4.0" "WFDB Applications Guide"
.SH NAME
mfilt \- general-purpose median filter for WFDB records
.SH SYNOPSIS
\fBmfilt -l\fR \fIlength\fR [ \fIoptions\fR ... ]
.SH DESCRIPTION
\fBmfilt\fR can be used to apply a median filter of any desired \fIlength\fR to
any desired section of a database record.  The \fIlength\fR is expressed in
samples (i.e., each output sample is the median of \fIlength\fR 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.
.PP
\fIOptions\fR are:
.TP
\fB-f\fR \fItime\fR
Filter from the specified \fItime\fR on the input record (default: start at the
beginning of the record).
.TP
\fB-h\fR
Print a usage summary.
.TP
\fB-H\fR
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).
.TP
\fB-i\fR \fIrecord\fR
Use the specified \fIrecord\fR for input (default: record 16).
.TP
\fB-l\fR \fIn\fR
Use an \fIn\fR-point median.
.TP
\fB-n\fR \fIrecord\fR
Write the output signals to \fIrecord\fB.dat\fR, using the same
specifications as the input signals, and create a header file for the
specified \fIrecord\fR.  This option overrides \fB-o\fR if both are used.
.TP
\fB-o\fR \fIrecord\fR
Use the specified \fIrecord\fR 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.
.TP
\fB-t \fItime\fR
Filter until the specified \fItime\fR on the input record (default: go to the
end of the record).
.PP
In the present implementation, the same filter is applied to each input signal.
For each output sample, an array of \fIlength\fR input samples centered on the
time of interest is sorted.  (More efficient algorithms for finding the median
exist, especially for large odd values of \fIlength\fR; see, for example,
\fINumerical Recipes\fR.)  If \fIlength\fR 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.
.SH ENVIRONMENT
.PP
It may be necessary to set and export the shell variable \fBWFDB\fR (see
\fBsetwfdb\fR(1)).
.SS Example
.PP
A 3-point median filter, applied to the first 5 minutes of record 100
to produce a new record 100m:
.br
	\fBmfilt -l 3 -i 100 -n 100m\fR
.SH SEE ALSO
\fBfir\fR(1)
.SH AUTHOR
George B. Moody (george@mit.edu)
.SH SOURCE
http://www.physionet.org/physiotools/wfdb/app/mfilt.c