Given a tibble of sample information (sample_info) with columns capture_area, group, and spaceranger_dir, Write new high-resolution images for use as input to ImageJ. Particularly when capture areas come from different slides, there is a risk of significant scale differences among Spaceranger's tissue_hires_image.png images; that is, the physical distance represented by a pixel from each capture area may differ nontrivially, leading to a distance-distorted output image, and inconsistent scaling when later transforming pixel coordinates. This function writes approximately high-res images whose pixels are of equal physical size within each group, then adds intra_group_scalar and group_hires_scalef columns to sample_info. intra_group_scalar gives the scalar by a which a given capture area's hires image and pixel coordinates must be multiplied to match the scale of other group members; group_hires_scalef gives the new tissue_hires_scalef (as from Spaceranger's scalefactors_json.json file) appropriate for every capture area from the group.

rescale_imagej_inputs(sample_info, out_dir)

Arguments

sample_info

A tibble with columns capture_area, group, and spaceranger_dir

out_dir

A character(1) vector giving a path to a directory to place the output images. Provided the parent exists, out_dir will be created if necessary.

Value

A tibble: a copy of sample_info with additional columns intra_group_scalar and group_hires_scalef

Author

Nicholas J. Eagles

Examples

if (FALSE) { # \dontrun{
#   For internal testing
sample_info <- readr::read_csv("dev/test_data/sample_info.csv")
prep_imagej_coords(sample_info, tempdir())
} # }

## TODO: add working examples
args(rescale_imagej_inputs)
#> function (sample_info, out_dir) 
#> NULL