AlignImages: Automatic alignment of HE stained tissue images

AlignImagesR Documentation

Automatic alignment of HE stained tissue images

Description

Image alignment or image registration consists in finding a rigid tranformation function that remaps pixels between two images so that two images are aligned. AlignImages allows you to align all images to a reference (any image present in the Seurat object) which simplifies the interpretation of spatial heatmaps and can be useful for creating 3D models. The transformation function is learned using the ICP (Iterative Closest Point) on two point sets which defines the edges of the tissues in the HE images. Note that this alignment works best for tissue sections that are intact, i.e. not cropped or folded. Also, because the method only used the edges of the tissue for alignment, you might end up with strange results if the tissue shape is symmetrical.

Usage

AlignImages(
  object,
  indices = NULL,
  reference.index = NULL,
  use.masked = FALSE,
  verbose = FALSE
)

## S3 method for class 'Staffli'
AlignImages(
  object,
  indices = NULL,
  reference.index = NULL,
  use.masked = FALSE,
  verbose = FALSE
)

## S3 method for class 'Seurat'
AlignImages(
  object,
  indices = NULL,
  reference.index = NULL,
  use.masked = FALSE,
  verbose = FALSE
)

Arguments

object

A Seurat object

indices

Integer: sample indices of images to align with reference

reference.index

Integer: sample index of referece image

use.masked

Setting this to TRUE will ignore any "processed" images available in the object and apply the alignment from scratch.

verbose

Print messages

Value

A Staffli object

A Seurat object

Examples

## Not run: 
# Create a new Staffli object, mask, align and plot images
st.obj <- CreateStaffliObject(imgs, meta.data)
st.obj <- LoadImages(st.obj, verbose = TRUE) %>% MaskImages() %>% AlignImages()
plot(st.obj)

## End(Not run)
## Not run: 
# Load, mask, align and plot images
se <- LoadImages(se, verbose = TRUE) %>% MaskImages() %>% AlignImages()
ImagePlot(se)

## End(Not run)

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