Backgroundsubtracter
Purpose
Rolling-ball background subtraction for images.
Synopsis
- x_background = backgroundsubtracter(xin, radius, options); % (when options.createbackground = 1)
- x_minus_background = backgroundsubtracter(xin, radius, options); % (when options.createbackground = 0)
Description
BACKGROUNDSUBTRACTER subtracts a low-frequency 2D background from an image using the rolling-ball method implemented in ImageJ's Subtract Background command. The method identifies and removes a background from each slab of an image. The method is applied to each slice of the image in turn. The option 'createbackground' determines whether the output consists of the calculated background for each slice or the slice data minus the calculated background for that slice.
Based on the concept of the rolling ball algorithm described in Stanley Sternberg's article, "Biomedical Image Processing", IEEE Computer, January 1983.
Inputs
- x = NxMxSlices double array or Image DataSet,
- radius = Radius (in pixels) of the rolling ball calculating the background.
Outputs
- x = NxMxSlices double array or Image DataSet containing the input data with the background subtracted, or the subtracted background, depending on whether option createbackground equals 0 or 1, respectively.
Options
options = a structure array with the following fields.
- createbackground: [ {'0'} | '1'] Determines whether to return the background or to subtract it.
- lightbackground: [ {'0'} | '1'] Indicates the image has a light background.
- useparaboloid: [ {'0'} | '1'] Controls use of the "sliding paraboloid" algorithm.
- dopresmooth: [ {'0'} | '1'] Apply smooth image (3x3 mean) before creating?
- correctcorners: [ '0' | {'1'}] Indicates algorithm should try to detect corner particles to avoid subtracting them as a background.
Example
Apply backgroundsubtracter to the 'Swedish knackerbrod' image dataset. This returns a new image dataset where the input dataset layers have had their background subtracted, the background being calculated from a rolling ball with radius = 50 pixels.
load('smbread') options = backgroundsubtracter('options'); radius = 50; x_background = backgroundsubtracter(bread, radius, options);