WarpImages: Warps images using various transformations

WarpImagesR Documentation

Warps images using various transformations

Description

This function can be used to apply rigid transformations on masked images including; rotations, reflections and translations. See details below for more information.

Usage

WarpImages(object, transforms, verbose)

## S3 method for class 'Staffli'
WarpImages(object, transforms, verbose = FALSE)

## S3 method for class 'Seurat'
WarpImages(object, transforms, verbose = FALSE)

Arguments

object

Seurat object

transforms

List of arguments passed to warp function. The available options are "angle" [numeric], "mirror.x" [logical], "mirror.y" [logical], "shift.x" [numeric]and "shift.y" [numeric].

verbose

Print messages

Details

The transformations are controlled by specifying verious rigid transformations for each sample using the transforms variable. The transforms variable should be a named list of lists with one element for each sample that you want to apply a transformation on. For example, if you want to rotate sample 1 90 degrees clockwise and reflect sample 2 along its x axis you can pass 'transforms <- list("1" = list("angle" = 90), "2" = list("mirror.x" = TRUE))'. When multiple transformations are passed, they are applied in the following order; rotation -> reflection -> translation.

Value

Seurat object with processed imaged

A Staffli object

A Seurat object

Examples

## Not run: 
# Create a new Staffli object, mask, warp and plot images
st.obj <- CreateStaffliObject(imgs, meta.data)
transforms <- list("2" = list("mirror.y" = TRUE))
st.obj <- LoadImages(st.obj, verbose = TRUE) %>% MaskImages() %>% WarpImages(transforms)
plot(st.obj)

## End(Not run)
## Not run: 
# Load, mask, warp and plot images in a Seurat object
# Mirror y axis in sample '2' and rotate sample '3' 10 degrees
transforms <- list("2" = list("mirror.y" = TRUE), "3" = list("angle" = 10))
se <- LoadImages(se, verbose = TRUE) %>% MaskImages() %>% WarpImages(transforms)
ImagePlot(se)

## End(Not run)

jbergenstrahle/STUtility documentation built on March 14, 2023, 7:15 a.m.