calibrate: Calibrate cropping and rotation parameters

Description Usage Arguments Details

View source: R/calibrate.R

Description

This function calibrates plate cropping and rotation parameters for an image with an arbritrarily sized grid of plates.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
calibrate(
  dir = ".",
  grid_rows,
  grid_cols,
  rotate = 90,
  range = 2,
  thresh = 0.03,
  invert = TRUE,
  rough_pad = c(0, 0, 0, 0),
  fine_pad = c(0, 0, 0, 0),
  default_crop = NULL,
  overwrite = FALSE,
  display = TRUE,
  save_plate = !display,
  colony_radius = 1,
  max_smooth = 5
)

Arguments

dir

Directory of images to process.

grid_rows

Number of expected rows in colony grid.

grid_cols

Number of expected columns in colony grid.

rotate

A rough angle in degrees clockwise to rotate each plate. The rotation angle will be further calibrated after applying this rotation. Defaults to 90.

range

Range to explore (in degrees) when calibrating rotation angle. Defaults to 2.

thresh

Fraction of foreground pixels needed to identify plate boundaries when rough cropping. Defaults to 0.03.

invert

Should the image be inverted? Defaults to TRUE. Recommended TRUE if colonies are darker than the plate.

default_crop

If not NULL then use this dataframe as the default crop coordinates.

overwrite

Should existing crop calibration be overwritten? Defaults to FALSE.

display

Should cropped images be displayed for review? Defaults to TRUE.

save_plate

Should the calibrated plate be saved rather than displayed (useful when calibrating many plates)? Defaults to !display.

colony_radius

If <= 1, the box drawn around colonies will be this fraction of half the average distance between rows and columns (Defaults to 1). If > 1, the box will have a radius of this many pixels.

max_smooth

Maximum number of pixels to allow when smoothing row and column positions of individual colonies.

Details

Crop calibration procedes through the following 3 steps:

  1. Rough crop

  2. Rotate

  3. Fine crop

Rough cropping relies on high contrast between plates. If invert = TRUE plates should be light and the region between plates should be dark, and vice versa if invert = FALSE.

Fine cropping finds the nearest object edge (problematic for plates without any growth on the intended grid edges).


EricEdwardBryant/screenmill documentation built on March 13, 2020, 1:07 p.m.