blurImage: Apply a blurring filter

Description Usage Arguments Value References Examples

View source: R/imageProcessing.R

Description

The following function uses makeBrush to generate a filter of choice and applies it to the image. Blurring tends to be useful prior to analyzing individual objects in an image with ill-defined edges and/or uneven intensities.

Usage

1
2
3
4
5
6
blurImage(
  img,
  brush_size = 5,
  brush_shape = c("box", "disc", "diamond", "Gaussian", "line"),
  sigma = 0.3
)

Arguments

img

An object of Image class specific to EBImage, stored as multi- dimensional arrays containing the pixel intensities.

brush_size

A numeric value containing the size of the brush in pixels. This should be an odd number; even numbers are rounded to the next odd one, i.e., size = 4 has the same effect as size = 5. Default is 5.

brush_shape

A character vector indicating the shape of the brush. Can be box, disc, diamond,Gaussian or line. Default is box.

sigma

An optional numeric containing the standard deviation of the Gaussian shape.This argument is relevant only for the Gaussian brush shape.Default is 0.3.

Value

A blurred version of the input image.

References

Gregoire Pau, Florian Fuchs, Oleg Sklyar, Michael Boutros, and Wolfgang Huber (2010): EBImage - an R package for image processing with applications to cellular phenotypes. Bioinformatics, 26(7), pp. 979-981, link (https://bioconductor.org/packages/release/bioc/html/EBImage.html

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
# Example 1
# select nuclei channel in a tiff file
mouse = loadImage(system.file('extdata/Mouse_01.tiff', package='MyoManager'))
mNuc = selectFrame(mouse,3)
viewImage(mNuc)

# apply the blurring brush
img_blur <- blurImage(mNuc, 11, 'gaussian', sigma = 5)

# visualize blurred nuclei - brightening is optional (for display purpose)
viewImage(intensityCtrl(img_blur, 0, 3))

# Example 2
rabbit = loadImage(system.file('extdata/Rabbit_01.tif', package='MyoManager'))
rNuc = selectFrame(rabbit, 3)
viewImage(rNuc)
img_blur = blurImage(rNuc, 11, 'line')
viewImage(img_blur)

karenkuang37/MyoManager documentation built on Dec. 21, 2021, 5:18 a.m.