# PYME.recipes.filters module¶

Created on Fri Feb 20 17:11:05 2015

@author: david

class PYME.recipes.filters.DespeckleFilter(parent=None, **kwargs)

Attempts to remove speckle from an image.

The despeckle filter functions by replacing a value of each pixel with the median of the nPix pixels within the filter support which are closest in intensity to the value of the pixel itself.

Parameters: sizeX : size of filter kernel along x axis in pixels sizeY : size of filter kernel along y axis in pixels sizeZ : size of filter kernel along z axis in pixels nPix : number of pixels to use for the median

Notes

• The design intent is an edge-preserving filter for images which have a lot of shot noise (e.g. STED images)
• It is highly non-linear, and thus best suited for either treating images for display, or potentially segmentation. It should NOT be used if intensities need to be quantified or prior to operations such as deconvolution.
• sizeZ is ignored and a 2D filtering performed if processFramesIndividually is selected

Attributes

 default_view hide_in_overview inputs outputs pipeline_view pipeline_view_min sigmas

Methods

 applyFilter(data, chanNum, frNum, im) completeMetadata(im) trait_items_event(event_trait,name,items_event) trait_property_changed(...) traits_init() traits_inited([True])
applyFilter(data, chanNum, frNum, im)
completeMetadata(im)
sigmas
class PYME.recipes.filters.DoGFilter(parent=None, **kwargs)

Difference of Gaussians

Blurs the image with 2 different sized Gaussians and subtracts them. Commonly used to detect points or blobs. The smaller Gaussian should be set to match the desired blob size and acts as a noise reduction filter, wheras the larger Gaussian (which is subtracted) can be thought of as a form of local background estimation.

Parameters: sigmaX, sigmaY, sigmaZ : std. deviation of the smaller Gaussian. sigmaX2, sigmaY2, sigmaZ2 : std. deviations of the larger Gaussian

Notes

• implemented as 2 calls to scipy.ndimage.gaussian_filter
• sigmaZ and sigmaZ2 are ignored and a 2D filtering performed if processFramesIndividually is selected

Attributes

 default_view hide_in_overview inputs outputs pipeline_view pipeline_view_min sigma2s sigmas

Methods

 applyFilter(data, chanNum, frNum, im) completeMetadata(im) trait_items_event(event_trait,name,items_event) trait_property_changed(...) traits_init() traits_inited([True])
applyFilter(data, chanNum, frNum, im)
completeMetadata(im)
sigma2s
sigmas
class PYME.recipes.filters.GaussianFilter(parent=None, **kwargs)

Performs a Gaussian filter of the input image

Parameters: sigmaX : std. deviation of filter kernel along x axis in pixels sigmaY : std. deviation of filter kernel along y axis in pixels sigmaZ : std. deviation of filter kernel along z axisin pixels

Notes

• implemented as a call to scipy.ndimage.gaussian_filter
• sigmaZ is ignored and a 2D filtering performed if processFramesIndividually is selected

Attributes

 default_view hide_in_overview inputs outputs pipeline_view pipeline_view_min sigmas

Methods

 applyFilter(data, chanNum, frNum, im) completeMetadata(im) trait_items_event(event_trait,name,items_event) trait_property_changed(...) traits_init() traits_inited([True])
applyFilter(data, chanNum, frNum, im)
completeMetadata(im)
sigmas
class PYME.recipes.filters.MaskEdges(parent=None, **kwargs)

Sets the edge pixels of an image to zero.

Used to prevent objects near the edge of an image from being detected if they might not be processed properly in subsequent object measurement or fitting routines.

Parameters: widthPxels : the distance from the edge to mask with 0s

Attributes

 default_view hide_in_overview inputs outputs pipeline_view pipeline_view_min

Methods

 applyFilter(data, chanNum, frNum, im) trait_items_event(event_trait,name,items_event) trait_property_changed(...) traits_init() traits_inited([True])
applyFilter(data, chanNum, frNum, im)
class PYME.recipes.filters.MeanFilter(parent=None, **kwargs)

Performs a mean / uniform filter of the input image

Parameters: sizeX : size of filter kernel along x axis in pixels sizeY : size of filter kernel along y axis in pixels sizeZ : size of filter kernel along z axis in pixels

Notes

• implemented as a call to scipy.ndimage.mean_filter
• sizeZ is ignored and a 2D filtering performed if processFramesIndividually is selected

Attributes

 default_view hide_in_overview inputs outputs pipeline_view pipeline_view_min sigmas

Methods

 applyFilter(data, chanNum, frNum, im) completeMetadata(im) trait_items_event(event_trait,name,items_event) trait_property_changed(...) traits_init() traits_inited([True])
applyFilter(data, chanNum, frNum, im)
completeMetadata(im)
sigmas
class PYME.recipes.filters.MedianFilter(parent=None, **kwargs)

Performs a median filter of the input image

Parameters: sizeX : size of filter kernel along x axis in pixels sizeY : size of filter kernel along y axis in pixels sizeZ : size of filter kernel along z axisin pixels

Notes

• implemented as a call to scipy.ndimage.median_filter
• sizeZ is ignored and a 2D filtering performed if processFramesIndividually is selected

Attributes

 default_view hide_in_overview inputs outputs pipeline_view pipeline_view_min sigmas

Methods

 applyFilter(data, chanNum, frNum, im) completeMetadata(im) trait_items_event(event_trait,name,items_event) trait_property_changed(...) traits_init() traits_inited([True])
applyFilter(data, chanNum, frNum, im)
completeMetadata(im)
sigmas
class PYME.recipes.filters.Zoom(parent=None, **kwargs)

Zoom / resize an image using ndimage.zoom

Parameters: zoom : factor by which to zoom the image

Notes

• zoom is isotropic in 3D if processFramesIndividually is False
• zoom only zooms in x and y if processFramesIndividually is True

Attributes

 default_view hide_in_overview inputs outputs pipeline_view pipeline_view_min

Methods

 applyFilter(data, chanNum, frNum, im) completeMetadata(im) trait_items_event(event_trait,name,items_event) trait_property_changed(...) traits_init() traits_inited([True])
applyFilter(data, chanNum, frNum, im)
completeMetadata(im)