splitXrayImage: Split x-ray image

View source: R/manageXray.R

splitXrayImageR Documentation

Split x-ray image

Description

Split x-ray image into individual packets

Usage

splitXrayImage(
  imgFile,
  outFolder,
  hh,
  prefixLet,
  plotAndAsk = F,
  onlyInhh = F,
  xScale = c(0, 0.21, 0.39, 0.57, 0.75, 1),
  yScale = c(0, 0.2583333, 0.5, 0.7416667, 1),
  fudge = 0.03
)

Arguments

imgFile

the x-ray (current jpg) image file to split

outFolder

where to save all the individual images

hh

the hh.year file from which the full letnos will be found. Default is hh.2015

prefixLet

the letter(s) to put in front of the name of the output file e.g. for b1434sd.jpg prefixLet = 'b'

plotAndAsk

logical. If TRUE, it will plot the individual packet images to make sure that you're content with the results. Otherwise, it automatically saves without plotting or asking.

onlyInhh

logical, if TRUE it will automatically delete images corresponding to letnos that are not in hh. Default is FALSE.

xScale

a vector describing the locations at which the image should be cut as a proportion of the total image width

yScale

a vector describing the locations at which the image should be cut as a proportion of the total image height

fudge

numeric. A fudge factor between 0 and 1 representing the proportion of the height or width to add to each packet image when cutting the original image into chunks

Details

The imgFile name should be the letno of the first packet on the x-ray image. All letnos on the image should go in order and if letnos are missing, there should be nothing in that location on the sheet. If outfolder doesn't exist, it will be created. There's a slight "fudge factor" so that doesn't split the image equally, but rather, splits it so that each image contains slightly more than "its fair share" of the image. That's not scientific so I'll also say: every packet image is more than 1/5 the width of the original image and is more than 1/4 the height of the original image

Value

invisibly returns the list of individuals images as cimg objects


stuartWagenius/echinaceaLab documentation built on April 13, 2025, 5:22 a.m.