auto_crop_fast: auto_crop_fast

Description Usage Arguments Details Value Author(s) Examples

View source: R/auto_crop_fast.R

Description

crop an image around each viable cell candidate.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
auto_crop_fast(
  img_path,
  max_cell_area = 20000,
  min_cell_area = 7000,
  mean_pix = 0.08,
  annotation = "off",
  blob_factor = 15,
  bg_blob_factor = 10,
  offset = 0.2,
  final_blob_amp = 10,
  test_amount = 0,
  brush_size_blob = 51,
  sigma_blob = 15,
  channel3_string = "DAPI",
  channel2_string = "SYCP3",
  channel1_string = "MLH3",
  file_ext = "jpeg",
  third_channel = "off",
  cell_aspect_ratio = 2,
  strand_amp = 2,
  path_out = img_path,
  resize_l = 720,
  crowded_cells = "FALSE",
  watershed_radius = 50,
  watershed_tol = 0.2,
  cropping_factor = 1.3
)

Arguments

img_path,

path containing image data to analyse

max_cell_area,

Maximum pixel area of a cell candidate

min_cell_area,

Minimum pixel area of a cell candidate

mean_pix,

Mean pixel intensity of cell crop (in SYCP3 channel) for normalisation

annotation,

Choice to output pipeline choices (recommended to knit)

blob_factor,

Contrast factor to multiply original image by before smoothing/smudging

bg_blob_factor,

Contrast factor to multiply original image by to take background. Used prior to thresholding.

offset,

Pixel value offset from bg_blob_factor. Used in thresholding to make blob mask.

final_blob_amp,

Contrast factor to multiply smoothed/smudged image. Used in thresholding to make blob mask.

test_amount,

Optional number of first N images you want to run function on. For troubleshooting/testing/variable calibration purposes.

brush_size_blob,

Brush size for smudging the synaptonemal complex channel to make blobs

sigma_blob,

Sigma in Gaussian brush for smudging the synaptonemal complex channel to make blobs

channel3_string

Optional. String appended to the files showing the channel illuminating cell structures. Defaults to DAPI, if third channel == "on".

channel2_string

String appended to the files showing the channel illuminating synaptonemal complexes. Defaults to SYCP3

channel1_string

String appended to the files showing the channel illuminating foci. Defaults to MLH3

file_ext

file extension of your images e.g. tif jpeg or png.

third_channel

Optional, defaults to "off". Set to "on" if you would also like crops of the third channel.

cell_aspect_ratio

Maximum aspect ratio of blob to be defined as a cell

strand_amp

multiplication of strand channel for get_blobs function.

path_out,

user specified output path. Defaults to img_path

resize_l

length for resized image

crowded_cells

TRUE or FALSE, defaults to FALSE. Set to TRUE if you have many cells in a frame that almost touch

watershed_radius

Radius (ext variable) in watershed method used in strand channel. Defaults to 1 (small)

watershed_tol

Intensity tolerance for watershed method. Defaults to 0.05.

cropping_factor

size of cropping window square, as factor of characteristic blob radius. Defaults to 1. May need to increase if using watershed.

Details

This function takes all images in a directory, and crops around individual cells according to the antibody that stains synaptonemal complexes e.g. SYCP3. First, it increases the brightness and smudges the image with a Gaussian brush, and creates a mask using thresholding (get_blobs). Then it deletes cell candidates in the mask deemed too large, too small, or too long (keep_cells). Using the computeFeatures functions from EBImage to locate centre and radius, the cropping area is determined and the original image cropped. These images are saved in either a user specified directory, or a crops folder at the location of the image files.

Value

cropped synaptonemal complex and foci channels around single cells, regardless of stage

Author(s)

Lucy McNeill

Examples

1
2
3
demo_path = paste0(system.file("extdata",package = "synapsis"))
auto_crop_fast(demo_path, annotation = "on", max_cell_area = 30000,
min_cell_area = 7000, file_ext = "tif",crowded_cells = TRUE)

mcneilllucy/synapsis documentation built on Dec. 21, 2021, 3:59 p.m.