Statistical Methods

Check Local Median Filtering Before Smoothing Research Images

Define the task

Median filtering replaces a cell by a middle-ranked value from a local footprint. It can suppress isolated extremes, but it may also erase small structures and alter boundaries. Preserve the original array and specify the footprint, origin, edge rule and handling of nonfinite values. The teaching tool uses a centered 3×3 square, finite inputs and nearest-edge replication, with no claim that filtering improves a measurement.

Carry out the check

List the nine contributing values for a cell and select the fifth after sorting. At a boundary, document which values are repeated. For this radius-one footprint, nearest replication and half-sample reflection give the same immediate padding; they can differ for wider footprints. Do not generalize this tool's behavior to every library default or even-sized filter, where the selected rank may differ from averaging two middle values.

Worked hypothetical example

Hypothetical example: a 3×3 grid of ones with central value 99 becomes all ones under the stated filter. The central neighborhood has eight ones and one 99, so its fifth value is 1. Only the center changes. This confirms the implementation's handling of an isolated extreme; it does not establish that a bright single-pixel feature in real data is noise. Save before/after values and justify the filtering choice before analysis.

Method checked 23 November 2026 against Primary method documentation: median_filter.

Open the three-by-three median filter audit.

Related reading

Reading path: Analyze data. Guide 208 of 222. Choose any guide to suit your project.

Statistical Methods

Review Edge Effects Before Using Zero-Phase Filtering

Practical steps and a worked example: Separate phase behavior, doubled filtering and edge assumptions in offline processing.

Statistical Methods

Check a Graph Smoothing Penalty Against Its Edge Definitions

Practical steps and a hypothetical example: Measure disagreement across a weighted undirected graph.

Browse this reading pathTools for this stageGuides and downloads for this stage