Analysis › Process · version 1 · has a preview
Subtract a smooth background from an image layer – Gaussian, rolling ball or SMAP's wavelet – and/or normalise its local contrast; the result is a new image layer at the original's place.
Cleans up an image layer – a wide-field picture, a transmitted-light image, a rendered TIFF, the camera frames a fit kept – so that what is in it can be seen and compared with the localizations. Two operations, ticked on or off:
The result is a new image layer, added after the others and placed exactly over the original – the same pixel size, the same corner – so it lies over the localizations as the original does. The original is never changed: show the two side by side to judge the settings, and remove the new layer in the Render tab if they were wrong. Preview draws the result without adding anything.
Use it to see a wide-field channel under the localizations, to find cells or structures by eye, or to prepare an image before Register layers correlates it with a rendered layer: a background shared by nothing in the other image only blurs the correlation peak. Do not use the result to measure intensities: the background subtracted is an estimate, and the contrast normalisation changes the scale from place to place.
1. A background is estimated, by one of three methods:
2. It is subtracted. The result is what stands above the background, around zero where there is nothing.

An image with a sloping, uneven background (left), the background as it really was and as the Gaussian method found it, and what is left after subtracting it.

One row through the image: the structure as simulated (black) and what each method leaves of the image – the background gone, the structure close to its height.
3. Local contrast, if ticked, after the background. Around every pixel the plugin computes the mean and the spread (the standard deviation) of the image over a Gaussian window, subtracts the mean and divides by the spread. A faint filament in a dim corner then comes out as strong as a bright one in the middle. Where there is nothing but noise the spread is small, and dividing by it would turn the noise into texture; so the spread used is never below a floor, a fraction of its typical (median) value over the image.
4. The new layer is the processed image, named after the original with what was done to it – "wf (background subtracted)" – and placed where the original is. For a stack, only the plane the layer shows is processed, or every plane, each on its own (planes).
Units. The widths are set in nm and converted to pixels with the image's pixel size (the geometric mean of x and y for non-square pixels); the line under the form says what they are in pixels. The wavelet's level stays a level, as in SMAP.
The refinement of the Gaussian and the wavelet. With the smoothed image
, each round computes the robust SD of the residual,
with
, replaces every pixel with
by
, and smooths that to
; 5 rounds by default, 0 for a plain high-pass filter. Replacing the bright pixels rather than clipping them at the threshold matters for dense structures: clipped, each of them still lifted the background by three SDs, and on the simulation above the background came out about twice as far off.
The wavelet is the à trous ("with holes") transform with the B3-spline kernel , dilated by
at step
: the isotropic wavelet of the SMLM literature (Izeddin et al. 2012). Its approximation after
steps is a smoothing with an SD of
pixels – 4.6 at level 3.
The rolling ball is the grey opening of the image with a ball: , erosion then dilation, with
the ball's height profile
over the disc of radius
pixels. As in ImageJ the height is in the image's own units, so for an image of hundreds of photons the ball is nearly flat over its width. Also as in ImageJ, the image is first averaged over 3 × 3 pixels for the estimate – otherwise the ball rests on the noise's lowest values and the result sits about two noise SDs above zero – and a large ball is rolled on a coarser image: the minimum over blocks of 2 pixels above a radius of 10, 4 above 30, 8 above 100, the background interpolated back. On that coarser image a slope is followed only to within the slope over a block.
The edges. Every method needs the image beyond its edges. It is continued by point reflection, , which continues a slope as a slope, so a gradient across the field is removed right to the edge; the mirror reflection usual in filters bends it back and leaves a rim. The price: a bright spot right at the edge is continued as a dark one, which pulls the background down next to it.
Local contrast: with and
the local mean and variance over the Gaussian window,
with the floor. The result has no unit: about 1 is a typical local variation.
| setting | default | what it does |
|---|---|---|
image layerlayer | the first image layer | The image to process; the result is a new layer. Any image layer; the first image layer follows whichever is first. |
planesplanes | the one shown | Of a stack: the plane the layer shows, or each. Only for a stack. Every plane takes as many times as long as one. Choices: the one shown; every plane |
subtract backgroundbackground | on | A smooth background estimated and subtracted. |
| background | ||
methodbg.method | Gaussian | How the smooth background is estimated. The rolling ball is the safest choice for images with sharp structures on a smooth background; the Gaussian follows a background that curves within a few of its widths better; the wavelet is there to do what SMAP did. Choices: Gaussian; rolling ball; wavelet (SMAP) |
widthbg.sigma_nm | 1000 nm | The Gaussian's SD: wider than any structure kept. A few times wider than the widest structure to keep: about 1 µm for diffraction-limited spots and filaments, more for nuclei or whole cells. Too narrow and structures are eaten into; too wide and a background varying over a few µm is left. at least 1 nm |
ball radiusbg.radius_nm | 1000 nm | Wider than any structure kept. Larger than the half-width of the widest structure to keep, as for ImageJ. at least 1 nm |
levelbg.level | 3 | The scale is about 2^level pixels; SMAP's 2-4. 2 to 4 for wide-field images at 100 nm pixels, as in SMAP. 1 to 10 |
rounds (more)bg.rounds | 5 | Times bright structures are taken out of the estimate; 0: a plain high-pass. More rounds help when bright structures cover much of the image; beyond 5 little changes. 0 to 20 |
normalise contrastcontrast | off | Divide by the local SD, after the background. |
| local contrast | ||
windowlcn.window_nm | 1000 nm | The SD of the Gaussian window of the local mean and SD. About the size of the region over which brightness should be evened out: a few µm to even out a cell, less to bring out fine detail. at least 1 nm |
floor (more)lcn.floor | 0.5 | The local SD is at least this times its median. Lower brings out faint structure and noise with it; higher leaves dim regions dim. |
A new image layer, its name saying what was done, and a figure of the plane shown: the original, the background taken away, and the result. A good background subtraction leaves the empty parts of the image around zero and the structures at their height; dark halos around bright structures mean the width or ball is too small, and a residual gradient that it is too large. The new layer is kept in the session's file when it is saved.
Based on SMAP's Tiff_remove_BG (Ries 2020). The main changes:
mywaveletfilteratrous). Its refinement – an estimate at twice the level, the residual clipped once at three SDs, smoothed again – is replaced by the rounds described above, so the wavelet and the Gaussian differ only in their smoothing.