SOCR ≫ DSPA ≫ DSPA2 Topics ≫

In this DSPA Appendix, we present examples of image processing, spectral manipulation, and filtering.

## Warning: package 'knitr' was built under R version 4.1.2

1 Getting started

r Biocpkg(“EBImage”) is an R package distributed as part of the Bioconductor project. To install the package, start R and enter:


Once the R package(“EBImage”) is installed, it can be loaded by the following command.

  • Note: If you can’t install the EBImage package for any reason (e.g., operating system or version incompatibility, this is not a problem as you should be able to use the jpeg package instead.
# install.packages("jpeg")

2 Reading, displaying and writing images

Basic R package(“EBImage”) functionality includes reading, writing, and displaying of images. Images are read using the function readImage, which takes as input a filename or an URL. To start off, let us load a sample picture distributed with the package.

f = system.file("images", "sample.png", package="EBImage")
img = readImage(f)

The R package (“EBImage”) currently supports three image file formats: jpeg, png and tiff. Additional image formats can be imported using the R GitHubPkg (“aoles/RBioFormats”), which adds support for a wide range of file formats including proprietary microscopy image data and metadata.

Imported images can be visualized by the function display().

display(img, method="browser")