patternize {patternize} | R Documentation |
patternize - An R package for quantifying color pattern variation.
Description
Quantifying variation in color patterns to study and compare the consistency of their expression necessitates the homologous alignment and color-based segmentation of images. Patternize is an R package that quantifies variation in color patterns as obtained from image data. Patternize defines homology between pattern positions across specimens either through fixed landmarks or image registration. Pattern identification is performed by categorizing the distribution of colors using either an RGB threshold or an unsupervised image segmentation. The quantification of the color patterns can be visualized as heat maps and compared between sets of samples.
patternize main functions
The package has six main functions depending on how you want the alignment of the iamges and the color extraction to be performed.
patLanRGB
Aligns images by transformations obtained from fixed landmarks and extracts colors using
a predefined RGB values and cutoff value.
patLanK
Aligns images by transformations obtained from fixed landmarks and extracts colors using
k-means clustering.
patLanW
Aligns images by transformations obtained from fixed landmarks and extracts color
patterns by watershed segmentation using imager
utilities.
patRegRGB
Aligns images using niftyreg
utilities for automated image
registration and extracts colors using a predefined RGB values and cutoff value.
patRegK
Aligns images using niftyreg
utilities for automated image
registration and extracts colors using k-means clustering.
patRegW
Aligns images using niftyreg
utilities for automated image
registration and extracts color patterns by watershed segmentation using
imager
utilities.
patternize preprocessing functions
The input for the main patternize functions are RasterStack
objects and when landmark
transformation is used, landmark arrays.
makeList
This function returns a list of RasterStacks or a list of landmarks depending on the input
provided.
sampleLandmarks
Sample landmarks in an image.
lanArray
This function creates a landmark array as used by procSym
in the
package Morpho
.
patternize postprocessing functions
sumRaster
This function sums the individual color pattern rasters as obtained by the main patternize
functions.
plotHeat
Plots the color pattern heatmaps from sumRaster
output.
patPCA
This function transforms the individual color pattern rasters as obtained by the main
patternize functions to a dataframe of 0 and 1 values that can be used for Principal
Component Analysis (prcomp
). This function also allows to plot the
analysis including a visualization of the shape changes along the axis.
patRDA
This function transforms the individual color pattern rasters as obtained by the main
patternize functions to a dataframe of 0 and 1 values that can be used for constrained
Redundancy Analysis (rda
). This function also allows to plot the
analysis including a visualization of the shape changes along the axis.
patArea
This fucntion calculates the area in which the color pattern is expressed in each sample
as the relative proportion using the provided outline of the considered trait or structure.
patternize miscellaneous functions
redRes
Reduces the resolution of the RasterStack
objects to speed up analysis.
kImage
Performs k-means clustering of images.
sampleRGB
Interactive function to sample RGB value from pixel or area in an image.
createTarget
Creates an artificial target images using a provided outline that can be used for image
registration (experimantal).
maskOutline
Intersects a RasterStack with an outline. Everything outside of the outline will be removed
from the raster.
colorChecker
Calibrate images using ColorChecker.
Author(s)
Steven M. Van Belleghem
See Also
raster
,
stack
,
procSym
,
computeTransform
,
niftyreg
imager
Jon Clayden, Marc Modat, Benoit Presles, Thanasis Anthopoulos and Pankaj Daga (2017).
RNiftyReg: Image Registration Using the 'NiftyReg' Library. R package version 2.5.0.
https://CRAN.R-project.org/package=RNiftyReg
Stefan Schlager (2016). Morpho: Calculations and Visualisations Related to Geometric
Morphometrics. R package version 2.4.1.1. https://github.com/zarquon42b/Morpho
Simon Barthelmé (2017). imager: Image processing library based on ‘CImg’. R package
version 0.40.2. https://CRAN.R-project.org/package=imager