The SPATA2 object allows for the storage of multiple images by registering them one by one with registerImage(). For each registered image, a container object of class HistoImage is created, storing the image and/or the file directory to the image, alongside additional information and data acquired during image processing steps (e.g., the tissue outline).

Working with multiple images alongside the coordinates of the data points around which the SPATA2 object revolves, as well as spatial reference features (SpatialAnnotation, SpatialTrajectory), presents a challenge: Alignment.

Alignment involves resolution matching of the image and justification of the images in terms of angle, horizontal or vertical translation, and stretching. This is particularly important for images taken from neighboring tissue sections that are similar but do not overlap perfectly.

The reference image

To facilitate alignment and vertical integration of multiple images, coordinates, and spatial reference features, a reference image is declared. By default, it is the first image loaded into the SPATA2 object. SPATA2 assumes that coordinates and the reference image align perfectly in terms of vertical and horizontal justification (scaling might still be needed). Hence, aligning additional registered images with the reference image should automatically result in alignment with the coordinates of the data points. Furthermore, having a reference image allows automatic transfer of scale factors to newly registered images.

The active image

(Only relevant if there are more than one image registered.)

The active image is simply the image that is used by default when it comes to any usage of functions that require image input. This is the case for visualizing functions e.g. createImageAnnotations() or plotSpatialAnnotations() as well as functions that extract any sort of coordinates, since, upon extraction, coordinates are scaled to the resolution of the image that is currently active (x_orig -> x, explained here). The reference image can therefore be simultaneously the active image.