plotHeat: Plots the color pattern heatmaps from 'sumRaster' output.

View source: R/plotHeat.R

plotHeatR Documentation

Plots the color pattern heatmaps from sumRaster output.

Description

Plots the color pattern heatmaps from sumRaster output.

Usage

plotHeat(
  summedRaster,
  IDlist,
  colpalette = NULL,
  plotCartoon = FALSE,
  refShape = NULL,
  outline = NULL,
  lines = NULL,
  landList = NULL,
  adjustCoords = FALSE,
  cartoonID = NULL,
  normalized = FALSE,
  crop = c(0, 0, 0, 0),
  flipRaster = NULL,
  flipOutline = NULL,
  imageList = NULL,
  refImage = NULL,
  cartoonOrder = "above",
  lineOrder = "above",
  cartoonCol = "gray",
  cartoonFill = NULL,
  plotLandmarks = FALSE,
  landCol = "black",
  zlim = c(0, 1),
  legend = TRUE,
  legendTitle = "Proportion",
  legend.side = 4,
  xlab = "",
  ylab = "",
  main = "",
  plotType = "multi",
  imageIDs = NULL,
  format = "imageJ"
)

Arguments

summedRaster

Summed raster or summedRasterList.

IDlist

List of sample IDs.

colpalette

Vector of colors for color palette (default = c("white","lightblue","blue","green", "yellow","red"))

plotCartoon

Whether to plot a cartoon. This cartoon should be drawn on one of the samples used in the analysis.

refShape

This can be 'target' in case the reference shape is a single sample (for registration analysis) or 'mean' if the images were transformed to a mean shape (only for meanshape when using landmark transformation)

outline

xy coordinates that define outline.

lines

list of files with xy coordinates of line objects to be added to cartoon.

landList

Landmark landmarkList.

adjustCoords

Adjust landmark coordinates.

cartoonID

ID of the sample for which the cartoon was drawn.

normalized

Set this to true in case the summed rasters are already devided by the sample number.

crop

Vector c(xmin, xmax, ymin, ymax) that specifies the pixel coordinates to crop the original image used in landmark or registration analysis.

flipRaster

Whether to flip raster along xy axis (in case there is an inconsistency between raster and outline coordinates).

flipOutline

Whether to flip plot along x, y or xy axis.

imageList

List of images should be given if one wants to flip the outline or adjust landmark coordinates.

refImage

Image (RasterStack) used for target. Use raster::stack('filename').

cartoonOrder

Whether to plot the cartoon outline 'above' or 'under' the pattern raster (default = 'above'). Set to 'under' for filled outlines.

lineOrder

Whether to plot the cartoon lines 'above' or 'under' the pattern raster (default = 'above').

cartoonCol

Outline and line color for cartoon (deafault = 'gray').

cartoonFill

Fill color for outline of cartoon (default = NULL).

plotLandmarks

Whether to plot the landmarks from the target image or mean shape landmarks (default = FALSE).

landCol

Color for ploting landmarks (default = 'black').

zlim

z-axis limit (default = c(0,1))

legend

Whether to plot legend with heatmaps.

legendTitle

Title of the raster legend (default = 'Proportion')

legend.side

Side to plot legend (default = 4)

xlab

Optional x-axis label.

ylab

Optional y-axis label.

main

Optional main title.

plotType

Set as 'PCA' when visualizing shape changes along PCA axis in \ codepatPCA, as 'one' when visualizing single image or as 'multi' for multi plotting or when setting customized margins (default = 'multi').

imageIDs

A list of IDs to match landmarks to images if landmarkList and imageList don't have the same length.

format

ImageJ (Fiji) or tps format (default = 'imageJ').

Examples

data(rasterList_lanRGB)
IDlist <- c('BC0077','BC0071','BC0050','BC0049','BC0004')
outline_BC0077 <- read.table(paste(system.file("extdata",  package = 'patternize'),
'/BC0077_outline.txt', sep=''), header = FALSE)
lines_BC0077 <- list.files(path=paste(system.file("extdata",  package = 'patternize')),
pattern='vein', full.names = TRUE)

summedRaster_regRGB <- sumRaster(rasterList_regRGB, IDlist, type = 'RGB')
data(imageList)

plotHeat(summedRaster_regRGB, IDlist, plotCartoon = TRUE, refShape = 'target',
outline = outline_BC0077, lines = lines_BC0077, crop = c(100,400,40,250),
flipRaster = 'xy', imageList = imageList, cartoonOrder = 'under', cartoonID = 'BC0077',
cartoonFill = 'black', main = 'registration_example')

## Not run: 
data(rasterList_lanK)
IDlist <- c('BC0077','BC0071','BC0050','BC0049','BC0004')
summedRasterList <- sumRaster(rasterList_lanK, IDlist, type = 'k')
plotHeat(summedRasterList, IDlist)

summedRasterList_regK <- sumRaster(rasterList_regK, IDlist, type = 'k')
plotHeat(summedRasterList_regK, IDlist, plotCartoon = TRUE, refShape = 'target',
outline = outline_BC0077, lines = lines_BC0077, crop = c(100,400,40,250),
flipRaster = 'y', imageList = imageList, cartoonOrder = 'under',
cartoonFill = 'black', main = 'kmeans_example')

plotHeat(summedRasterList_regK[[1]], IDlist, plotCartoon = TRUE, refShape = 'target',
outline = outline_BC0077, lines = lines_BC0077, crop = c(100,400,40,250),
flipRaster = 'y', imageList = imageList, cartoonOrder = 'under',
cartoonFill = 'black', main = 'kmeans_example')


prepath <- system.file("extdata", package = 'patternize')
extension <- '_landmarks_LFW.txt'
landmarkList <- makeList(IDlist, 'landmark', prepath, extension)

summedRaster_lanRGB <- sumRaster(rasterList_lanRGB, IDlist, type = 'RGB')

plotHeat(summedRaster_lanRGB, IDlist, plotCartoon = TRUE, refShape = 'mean',
outline = outline_BC0077, lines = lines_BC0077, landList = landmarkList,
adjustCoords = TRUE, imageList = imageList, cartoonID = 'BC0077',
cartoonOrder = 'under', cartoonFill= 'black', main = 'Landmark_example')

summedRaster_lanK <- sumRaster(rasterList_lanK, IDlist, type = 'k')

plotHeat(summedRaster_lanK, IDlist, plotCartoon = TRUE, refShape = 'mean',
outline = outline_BC0077, lines = lines_BC0077, landList = landmarkList,
adjustCoords = TRUE, imageList = imageList, cartoonID = 'BC0077',
cartoonOrder = 'under', cartoonFill= 'black', main = 'Landmark_example')

plotHeat(summedRaster_lanK[[2]], IDlist, plotCartoon = TRUE, refShape = 'mean',
outline = outline_BC0077, lines = lines_BC0077, landList = landmarkList,
adjustCoords = TRUE, imageList = imageList, cartoonID = 'BC0077',
cartoonOrder = 'under', cartoonFill= 'black', main = 'Landmark_example')

## End(Not run)


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