AndersenLab / easyfulcrum

easyfulcrum
Other
1 stars 0 forks source link

Change procPhotos function to resize based on max dimension #11

Closed tcrombie closed 4 years ago

tcrombie commented 4 years ago

Need to have a standardized size of images. Current preference for CeNDR is 500px as max dimension.

tcrombie commented 4 years ago

rewrote function to use max_dim

#' procPhotos
#'
#' \code{procPhotos} copies raw sample photos from the Fulcrum export and renames them to strain_name_C-label for use with CeNDR. The function also makes thumbnails.
#'
#' @param dir a directory with sample photos.
#' @param data a data frame output from the \code{joinGenoFulc} function.
#' @param max_dim This value sets the maximum dimension of the thumbnail images in pixels. The default value is 500.
#' @param overwrite Logical, passed to fs::file_copy. If \code{TRUE} then existing files with similar names will be written over. Default is \code{FALSE}.
#' @return A folder named processed_photos in the data/processed/fulcrum directory. The folder contains full size sample photos renamed with strain names.
#' A thumbnails subfolder is also returned within the processed_photos folder. This folder contains image thumbnails. A dataframe identical to input \code{data}
#' with md5 hash values and file names for all photos.
#' @importFrom rebus ALPHA one_or_more %R% DGT WRD optional
#' @importFrom imager load.image resize save.image
#' @export
#'