patLanW: Extracts color pattern from landmark transformed image using...

View source: R/patLanW.R

patLanWR Documentation

Extracts color pattern from landmark transformed image using watershed segmentation. This function works interactively by allowing to pick a starting pixel within each pattern element from which the watershed will extract the pattern. This function works best for patterns with sharp boundaries.

Description

Extracts color pattern from landmark transformed image using watershed segmentation. This function works interactively by allowing to pick a starting pixel within each pattern element from which the watershed will extract the pattern. This function works best for patterns with sharp boundaries.

Usage

patLanW(
  sampleList,
  landList,
  IDlist = NULL,
  adjustCoords = FALSE,
  transformRef = "meanshape",
  resampleFactor = NULL,
  transformType = "tps",
  maskOutline = NULL,
  cartoonID = NULL,
  correct = FALSE,
  blur = TRUE,
  sigma = 3,
  bucketfill = TRUE,
  cleanP = NULL,
  splitC = NULL,
  plotTransformed = FALSE,
  plotCorrect = FALSE,
  plotEdges = FALSE,
  plotPriority = FALSE,
  plotWS = FALSE,
  plotBF = FALSE,
  plotFinal = FALSE
)

Arguments

sampleList

List of RasterStack objects.

landList

Landmark list as returned by makeList.

IDlist

List of sample IDs should be specified when masking outline and transformRef is 'meanshape'.

adjustCoords

Adjust landmark coordinates in case they are reversed compared to pixel coordinates (default = FALSE).

transformRef

ID or landmark matrix of reference sample for shape to which color patterns will be transformed to. Can be 'meanshape' for transforming to mean shape of Procrustes analysis.

resampleFactor

Integer for downsampling image used by redRes.

transformType

Transformation type as used by computeTransform (default ='tps').

maskOutline

When outline is specified, everything outside of the outline will be masked for the color extraction (default = NULL).

cartoonID

ID of the sample for which the cartoon was drawn and will be used for masking (should be set when transformRef = 'meanShape').

correct

Correct image illumination using a linear model (default = FALSE).

blur

Blur image for priority map extraction (default = TRUE).

sigma

Size of sigma for Gaussian blurring (default = 5).

bucketfill

Use a bucket fill on the background to fill holes (default = TRUE).

cleanP

Integer to remove spurious areas with width smaller than cleanP (default = NULL).

splitC

Integer to split selected patterns into connected components and remove ones with areas smaller than splitC (default = NULL).

plotTransformed

Plot transformed image (default = FALSE).

plotCorrect

Plot corrected image, corrected for illumination using a linear model (default = FALSE).

plotEdges

Plot image gradient (default = FALSE).

plotPriority

Plot priority map (default = FALSE).

plotWS

Plot watershed result (default = FALSE).

plotBF

Plot bucketfill (default = FALSE).

plotFinal

Plot extracted patterns (default = FALSE).

Value

List of raster objects.

Examples


## Not run: 
IDlist <- c('BC0077','BC0071','BC0050','BC0049','BC0004')
prepath <- system.file("extdata",  package = 'patternize')
extension <- '_landmarks_LFW.txt'

landmarkList <- makeList(IDlist, 'landmark', prepath, extension)

extension <- '.jpg'
imageList <- makeList(IDlist, 'image', prepath, extension)

outline_BC0077 <- read.table(paste(system.file("extdata",  package = 'patternize'),
'/BC0077_outline.txt', sep=''), header = FALSE)

rasterList_W <- patLanW(imageList, landmarkList, IDlist, transformRef = 'meanshape',
adjustCoords = TRUE, plotTransformed = FALSE, correct = TRUE, plotCorrect = FALSE, blur = FALSE,
sigma = 2, bucketfill = FALSE, cleanP = 0, splitC = 10, plotPriority = TRUE, plotWS = TRUE,
plotBF = TRUE, plotFinal = TRUE, maskOutline = outline_BC0077, cartoonID = 'BC0077')

## End(Not run)


StevenVB12/patternize documentation built on Nov. 2, 2023, 8:01 p.m.