Commit ff8c602d authored by Lucy McNeill's avatar Lucy McNeill
Browse files

add package logo

parent cbcbc2fa
File added
......@@ -38,9 +38,9 @@
#' Used in thresholding to make blob mask.
#' @param test_amount, Optional number of first N images you want to run
#' function on. For troubleshooting/testing/variable calibration purposes.
#' @param brush_size_blob, Brush size for smudging the dna channel to make blobs
#' @param brush_size_blob, Brush size for smudging the synaptonemal complex channel to make blobs
#' @param cell_aspect_ratio Maximum aspect ratio of blob to be defined as a cell
#' @param sigma_blob, Sigma in Gaussian brush for smudging the dna channel
#' @param sigma_blob, Sigma in Gaussian brush for smudging the synaptonemal complex channel
#' to make blobs
#' @param channel1_string String appended to the files showing the channel
#' illuminating foci. Defaults to MLH3
......@@ -66,9 +66,9 @@
#' auto_crop_fast(demo_path, annotation = "on", max_cell_area = 30000,
#' min_cell_area = 7000)
#' @author Lucy McNeill
#' @return cropped SC and foci channels around single cells, regardless of stage
#' @return cropped synaptonemal complex and foci channels around single cells, regardless of stage
auto_crop_fast <- function(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)
auto_crop_fast <- function(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)
{
file_list <- list.files(img_path)
dir.create(paste0(path_out,"/crops"))
......@@ -78,7 +78,6 @@ auto_crop_fast <- function(img_path, max_cell_area = 20000, min_cell_area = 700
antibody1_store <- 0
antibody2_store <- 0
antibody3_store <- 0
## for each image that is *-dna.jpeg,
for (img_file in file_list){
file_base <- img_file
filename_path_test <- paste0(img_path,"/",img_file)
......@@ -92,9 +91,9 @@ auto_crop_fast <- function(img_path, max_cell_area = 20000, min_cell_area = 700
}
}
if(grepl(paste0('*',channel2_string,'.',file_ext,'$'), img_file)){
file_dna <- img_file
file_sc <- img_file
print(file)
image <- readImage(file_dna)
image <- readImage(file_sc)
img_orig <- channel(image, "grey")
img_orig_highres <- img_orig
img_orig <- resize(img_orig, w = resize_l, h = resize_l)
......@@ -165,10 +164,10 @@ auto_crop_fast <- function(img_path, max_cell_area = 20000, min_cell_area = 700
### row of interest is the counter_final'th row of x_final
cell_count <- cell_count +1
if(third_channel=="on"){
crop_single_object_fast(retained,OOI_final,counter_final,img_orig,img_orig_foci,img_orig_DAPI,file_dna,file_foci,file_DAPI,cell_count, mean_pix, annotation, file_base, img_path, r_max, cx, cy,channel3_string,channel2_string,channel1_string,file_ext,third_channel,path_out, img_orig_highres, resize_l,crowded_cells, cropping_factor)
crop_single_object_fast(retained,OOI_final,counter_final,img_orig,img_orig_foci,img_orig_DAPI,file_sc,file_foci,file_DAPI,cell_count, mean_pix, annotation, file_base, img_path, r_max, cx, cy,channel3_string,channel2_string,channel1_string,file_ext,third_channel,path_out, img_orig_highres, resize_l,crowded_cells, cropping_factor)
}
else{
crop_single_object_fast(retained,OOI_final,counter_final,img_orig,img_orig_foci,img_orig_foci,file_dna,file_foci,file_foci,cell_count, mean_pix, annotation, file_base, img_path, r_max, cx, cy,channel3_string,channel2_string,channel1_string,file_ext,third_channel,path_out, img_orig_highres, resize_l,crowded_cells, cropping_factor)
crop_single_object_fast(retained,OOI_final,counter_final,img_orig,img_orig_foci,img_orig_foci,file_sc,file_foci,file_foci,cell_count, mean_pix, annotation, file_base, img_path, r_max, cx, cy,channel3_string,channel2_string,channel1_string,file_ext,third_channel,path_out, img_orig_highres, resize_l,crowded_cells, cropping_factor)
}
}
antibody1_store <- 0
......@@ -176,7 +175,9 @@ auto_crop_fast <- function(img_path, max_cell_area = 20000, min_cell_area = 700
antibody3_store <- 0
}
}
cat("out of",image_count,"images, we got",cell_count,"viable cells \n", sep = " ")
crop_count <- nrow(as.data.frame(list.files(paste0(img_path,"/crops-RGB/"))))
print(crop_count)
cat("out of",image_count,"images, we got",crop_count,"viable cells \n", sep = " ")
}
......@@ -193,7 +194,7 @@ cat("out of",image_count,"images, we got",cell_count,"viable cells \n", sep = "
#' @param img_orig, description
#' @param img_orig_foci, description
#' @param img_orig_DAPI, description
#' @param file_dna, filename of dna channel image
#' @param file_sc, filename of synaptonemal complex channel image
#' @param file_foci, filename of foci channel image
#' @param file_DAPI, filename of DAPI channel image
#' @param cell_count, counter for successful crops around cells
......@@ -225,7 +226,7 @@ cat("out of",image_count,"images, we got",cell_count,"viable cells \n", sep = "
#' watershed.
#' @return Crops around all candidates in both channels
#'
crop_single_object_fast <- function(retained, OOI_final,counter_final,img_orig,img_orig_foci,img_orig_DAPI="blank",file_dna,file_foci,file_DAPI = "blank",cell_count, mean_pix, annotation, file_base, img_path, r_max, cx, cy,channel3_string,channel2_string,channel1_string,file_ext,third_channel,path_out, img_orig_highres, resize_l, crowded_cells,cropping_factor){
crop_single_object_fast <- function(retained, OOI_final,counter_final,img_orig,img_orig_foci,img_orig_DAPI="blank",file_sc,file_foci,file_DAPI = "blank",cell_count, mean_pix, annotation, file_base, img_path, r_max, cx, cy,channel3_string,channel2_string,channel1_string,file_ext,third_channel,path_out, img_orig_highres, resize_l, crowded_cells,cropping_factor){
tmp_img <- retained
###added
y <- distmap(tmp_img)
......@@ -265,7 +266,7 @@ crop_single_object_fast <- function(retained, OOI_final,counter_final,img_orig,i
if(third_channel == "on"){
noise_gone_DAPI <- bwlabel(resize(tmp_img, h = new_l, w = new_l))*as.matrix(img_orig_DAPI)
}
crop_r_highres <- floor(cropping_factor*floor(r_max[counter_final]*round( new_l/resize_l)))
crop_r_highres <- round(cropping_factor*floor(r_max[counter_final]*round( new_l/resize_l)))
cx_highres <- cx[counter_final]*( new_l/resize_l)
cy_highres <- cy[counter_final]*( new_l/resize_l)
top_left_x_highres <- floor(cx_highres-crop_r_highres)
......@@ -292,31 +293,31 @@ crop_single_object_fast <- function(retained, OOI_final,counter_final,img_orig,i
mean_factor <- mean_pix/orig_mean
new_img <- new_img*mean_factor
file_stub <- paste0('-',channel2_string,'.',file_ext)
file_dna <- gsub(file_stub,'', file_base)
filename_crop <- paste0(img_path_out,"/crops/", file_dna,"-crop-",cell_count,file_stub)
file_sc <- gsub(file_stub,'', file_base)
filename_crop <- paste0(img_path_out,"/crops/", file_sc,"-crop-",cell_count,file_stub)
writeImage(new_img, filename_crop)
new_img_foci <- noise_gone_foci[ix, iy]
file_stub <- paste0('-',channel1_string,'.',file_ext)
file_foci <- gsub(file_stub,'', file_foci)
filename_crop_foci <- paste0(img_path_out,"/crops/", file_dna,"-crop-",cell_count,file_stub)
filename_crop_foci <- paste0(img_path_out,"/crops/", file_sc,"-crop-",cell_count,file_stub)
writeImage(new_img_foci, filename_crop_foci)
### add RGB channel
ch1 <-channel(new_img,"grey")
ch2 <- channel(new_img_foci,"grey")
RGB_img <- rgbImage(ch1,ch2,0*ch1)
filename_crop_RGB <- paste0(img_path_out,"/crops-RGB/", file_dna,"-crop-",cell_count,file_stub)
filename_crop_RGB <- paste0(img_path_out,"/crops-RGB/", file_sc,"-crop-",cell_count,file_stub)
writeImage(RGB_img, filename_crop_RGB)
if(third_channel == "on"){
new_img_DAPI <- noise_gone_DAPI[ix, iy]
file_stub <- paste0('-',channel3_string,'.',file_ext)
file_DAPI <- gsub(file_stub,'', file_DAPI)
filename_crop_DAPI <- paste0(img_path_out,"/crops/", file_dna,"-crop-",cell_count,file_stub)
filename_crop_DAPI <- paste0(img_path_out,"/crops/", file_sc,"-crop-",cell_count,file_stub)
writeImage(new_img_DAPI, filename_crop_DAPI)
}
if(annotation=="on"){
print("from the file:")
print(file_dna)
print(file_sc)
plot(img_orig)
print("I cropped this cell:")
plot(new_img)
......@@ -356,8 +357,8 @@ crop_single_object_fast <- function(retained, OOI_final,counter_final,img_orig,i
#' to make blob mask.
#' @param final_blob_amp, Contrast factor to multiply smoothed/smudged image.
#' Used in thresholding to make blob mask.
#' @param brush_size_blob, Brush size for smudging the dna channel to make blobs
#' @param sigma_blob, Sigma in Gaussian brush for smudging the dna channel to
#' @param brush_size_blob, Brush size for smudging the synaptonemal complex channel to make blobs
#' @param sigma_blob, Sigma in Gaussian brush for smudging the synaptonemal complex channel to
#' make blobs
#' @param watershed_radius Radius (ext variable) in watershed method used
#' in strand channel. Defaults to 1 (small)
......@@ -371,7 +372,7 @@ crop_single_object_fast <- function(retained, OOI_final,counter_final,img_orig,i
get_blobs <- function(img_orig, blob_factor, bg_blob_factor, offset,final_blob_amp, brush_size_blob,sigma_blob, watershed_tol, watershed_radius, crowded_cells,annotation){
thresh <- blob_factor*img_orig
# subfunction: big blur to blobs
img_tmp_dna <- img_orig
img_tmp_sc <- img_orig
img_tmp <- thresh
w <- makeBrush(size = brush_size_blob, shape = 'gaussian', sigma = sigma_blob)
img_flo <- filter2(img_tmp, w)
......
#' count_foci
#'
#' Calculates coincident foci in SC and foci channel, per cell
#' Calculates coincident foci in synaptonemal complex and foci channel, per cell
#'
#' In this function, masks for the synaptonemal complex (SC) and foci channel
#' are created from the saved crops of single/individual cells.
......@@ -15,9 +15,9 @@
#' @export count_foci
#' @param img_path, path containing crops to analyse
#' @param stage, meiosis stage of interest. Currently count_foci determines
#' this with thresholding/ object properties in the dna channel. But will be
#' this with thresholding/ object properties in the synaptonemal complex channel. But will be
#' classified using ML model in future versions.
#' @param offset_px, Pixel value offset used in thresholding of dna channel
#' @param offset_px, Pixel value offset used in thresholding of synaptonemal complex channel
#' @param offset_factor, Pixel value offset used in thresholding of foci channel
#' @param brush_size, size of brush to smooth the foci channel. Should be small
#' to avoid erasing foci.
......@@ -47,7 +47,7 @@
#' @param artificial_amp_factor Amplification of foci channel, for annotation only.
#' @param strand_amp multiplication of strand channel to make masks
#' @param min_foci minimum pixel area for a foci. Depends on your dpi etc. Defaults to 4
#' @param disc_size size of disc for local background calculation in dna channel
#' @param disc_size size of disc for local background calculation in synaptonemal complex channel
#' @param modify_problematic option for synapsis to try and "save" images which
#' have likely been counted incorrectly due to a number of reasons. Default
#' settings are optimized for mouse pachytene. Defaults to "off"
......@@ -63,7 +63,7 @@
#' @return data frame with foci count per cell
count_foci <- function(img_path, stage = "none", offset_px = 0.2, offset_factor = 2, brush_size = 3, brush_sigma = 3, foci_norm = 0.01, annotation = "off",channel2_string = "SYCP3", channel1_string = "MLH3",file_ext = "jpeg", KO_str = "--",WT_str = "++",KO_out = "-/-", WT_out = "+/+", watershed_stop = "off", watershed_radius = 1, watershed_tol = 0.05, crowded_foci = TRUE, artificial_amp_factor = 1, strand_amp = 2, min_foci =-1, disc_size = 51, modify_problematic = "off", disc_size_foci = 7, C1 = 0.02, C2 = 0.46, C_weigh_foci_number = TRUE)
count_foci <- function(img_path, stage = "none", offset_px = 0.2, offset_factor = 2, brush_size = 3, brush_sigma = 3, foci_norm = 0.01, annotation = "off",channel2_string = "SYCP3", channel1_string = "MLH3",file_ext = "jpeg", KO_str = "--",WT_str = "++",KO_out = "-/-", WT_out = "+/+", watershed_stop = "off", watershed_radius = 1, watershed_tol = 0.05, crowded_foci = TRUE, artificial_amp_factor = 1, strand_amp = 2, min_foci =-1, disc_size = 51, modify_problematic = "off", disc_size_foci = 5, C1 = 0.02, C2 = 0.46, C_weigh_foci_number = TRUE)
{
cell_count <- 0
image_count <-0
......@@ -88,9 +88,9 @@ count_foci <- function(img_path, stage = "none", offset_px = 0.2, offset_factor
}
img_file <- filename_path_test
if(grepl(paste0('*',channel2_string,'.',file_ext,'$'), img_file)){
file_dna <- img_file
file_sc <- img_file
image_count <- image_count +1
image <- readImage(file_dna)
image <- readImage(file_sc)
img_orig <- channel(strand_amp*image, "grey")
antibody1_store <- 1
}
......@@ -141,7 +141,10 @@ count_foci <- function(img_path, stage = "none", offset_px = 0.2, offset_factor
#' @param foci_per_cell number of foci counted per cell
#' @return displays key steps from raw image to coincident foci count
#'
annotate_foci_counting <- function(img_file,cell_count,img_orig,img_orig_foci,artificial_amp_factor,strands,coincident_foci, foci_label,alone_foci,percent_px,foci_per_cell){
annotate_foci_counting <- function(img_file,cell_count,img_orig,img_orig_foci,
artificial_amp_factor,strands,
coincident_foci, foci_label,alone_foci,
percent_px,foci_per_cell){
cat("\n at file",img_file, sep = " ")
cat("\n cell counter is", cell_count, sep= " ")
cat("\n original images")
......@@ -311,10 +314,12 @@ remove_XY <- function(foci_label, foci_candidates, foci_areas){
#' to avoid erasing foci.
#' @param brush_sigma sigma for Gaussian smooth of foci channel. Should be
#' small to avoid erasing foci.
#' @param disc_size_foci size of disc for local background calculation in foci channel
#' @return foci mask
#'
#'
make_foci_mask <- function(offset_factor,bg,crowded_foci,img_orig_foci,brush_size,brush_sigma){
make_foci_mask <- function(offset_factor,bg,crowded_foci,img_orig_foci,
brush_size,brush_sigma,disc_size_foci){
foci_mask_crop <- img_orig_foci
offset <- offset_factor*bg
if(crowded_foci == TRUE){
......@@ -326,7 +331,7 @@ make_foci_mask <- function(offset_factor,bg,crowded_foci,img_orig_foci,brush_siz
w <- makeBrush(size = brush_size, shape = 'gaussian', sigma = brush_sigma)
img_flo <- filter2(img_tmp_contrast, w)
### using local bg
disc_size = 5
disc_size <- disc_size_foci
new_img<-img_flo
disc <- makeBrush(disc_size, "disc")
disc <- disc / sum(disc)
......@@ -347,10 +352,10 @@ make_foci_mask <- function(offset_factor,bg,crowded_foci,img_orig_foci,brush_siz
#'
#' creates strand mask for strand channel crop
#'
#' @param offset_px, Pixel value offset used in thresholding of dna channel
#' @param offset_px, Pixel value offset used in thresholding of synaptonemal complex channel
#' @param stage meitoic stage, currently pachytene or not.
#' @param img_orig original strand crop
#' @param disc_size size of disc for local background calculation in dna channel
#' @param disc_size size of disc for local background calculation in synaptonemal complex channel
#' @param brush_size, size of brush to smooth the foci channel. Should be small
#' to avoid erasing foci.
#' @param brush_sigma, sigma for Gaussian smooth of foci channel. Should be
......@@ -411,7 +416,7 @@ get_overlap_mask<- function(strands, foci_label, watershed_stop, img_orig_foci,
#' creates mask for coincident foci
#'
#' @param img_file cell's file name
#' @param offset_px, Pixel value offset used in thresholding of dna channel
#' @param offset_px, Pixel value offset used in thresholding of synaptonemal complex channel
#' @param stage meitoic stage, currently pachytene or not.
#' @param strands black white mask of strand channel
#' @param watershed_stop Stop default watershed method with "on"
......@@ -428,7 +433,6 @@ get_overlap_mask<- function(strands, foci_label, watershed_stop, img_orig_foci,
get_foci_per_cell <- function(img_file,offset_px,stage,strands,watershed_stop,foci_label, annotation, cell_count, img_orig, img_orig_foci, artificial_amp_factor, coincident_foci){
coincident_df <- data.frame(computeFeatures.shape(coincident_foci))
if(annotation == "on"){
print(coincident_df)
}
coincident_df <- coincident_df[coincident_df$s.area,]
### multiply strands by foci_label
......@@ -503,14 +507,21 @@ get_C1 <- function(foci_areas, foci_per_cell, C_weigh_foci_number){
#'
#' calculates the statistic to compare to crisp_criteria, which determines
#' whether the foci count will be reliable
#'
#' @param img_file cell's file name
#' @param cell_count unique cell counter
#' @param img_orig original strand crop
#' @param img_orig_foci cropped foci channel
#' @param C1_search TRUE or FALSE whether the image is still being modified
#' until it meets the crispness criteria
#' @param discrepant_category estimated number of foci that are NOT on a strand.
#' @param df_cells current data frame
#' @param C_weigh_foci_number choose crispness criteria- defaults to TRUE to use
#' C1 (weighing with number). Otherwise set to FALSE to use C2
#'
#' @param stage, meiosis stage of interest. Currently count_foci determines
#' this with thresholding/ object properties in the dna channel. But will be
#' this with thresholding/ object properties in the synaptonemal complex channel. But will be
#' classified using ML model in future versions.
#' @param offset_px, Pixel value offset used in thresholding of dna channel
#' @param offset_px, Pixel value offset used in thresholding of synaptonemal complex channel
#' @param offset_factor, Pixel value offset used in thresholding of foci channel
#' @param brush_size, size of brush to smooth the foci channel. Should be small
#' to avoid erasing foci.
......@@ -533,7 +544,7 @@ get_C1 <- function(foci_areas, foci_per_cell, C_weigh_foci_number){
#' have foci > 100 or so.
#' @param artificial_amp_factor Amplification of foci channel, for annotation only.
#' @param strand_amp multiplication of strand channel to make masks
#' @param disc_size size of disc for local background calculation in dna channel
#' @param disc_size size of disc for local background calculation in synaptonemal complex channel
#' @param disc_size_foci size of disc for local background calculation in foci channel
#' @param C_weigh_foci_number choose crispness criteria- defaults to TRUE to use
#' C1 (weighing with number). Otherwise set to FALSE to use C2
......@@ -556,7 +567,7 @@ get_coincident_foci <- function(offset_px, offset_factor, brush_size, brush_sigm
crisp_criteria <- C2
}
while(C1_search == TRUE && discrepant_category < 2){
foci_label <- make_foci_mask(offset_factor,bg,crowded_foci,img_orig_foci,brush_size,brush_sigma)
foci_label <- make_foci_mask(offset_factor,bg,crowded_foci,img_orig_foci,brush_size,brush_sigma,disc_size_foci)
foci_label <- channel(foci_label, "grey")
foci_candidates <- data.frame(computeFeatures.shape(foci_label))
foci_areas <- foci_candidates$s.area
......@@ -571,7 +582,6 @@ get_coincident_foci <- function(offset_px, offset_factor, brush_size, brush_sigm
}
if(C1 < crisp_criteria){
C1_search <- FALSE
print("i got one")
}
else{
discrepant_category <- discrepant_category + 1
......
......@@ -15,7 +15,7 @@
#' @param img_path, path containing crops analyse
#' @param path_out, user specified output path. Defaults to img_path
#' @param species_num, number of chromosomes in the species
#' @param offset, Pixel value offset used in therholding for the dna (SYCP3) channel
#' @param offset, Pixel value offset used in therholding for the synaptonemal complex (SYCP3) channel
#' @param ecc_thresh, The minimum average eccentricity of all objects in mask determined by computefeatures, for a cell to be pachytene.
#' @param area_thresh, The minimum ratio of pixels included in mask to total, for a cell to be classified as pachytene.
#' @param channel1_string String appended to the files showing the channel illuminating foci. Defaults to MLH3
......@@ -32,7 +32,7 @@
#' @examples demo_path = paste0(system.file("extdata",package = "synapsis"))
#' SYCP3_stats <- get_pachytene(demo_path,ecc_thresh = 0.8, area_thresh = 0.04, annotation = "on")
#' @author Lucy McNeill
#' @return Pairs of foci and SC channel crops for pachytene
#' @return Pairs of foci and synaptonemal channel crops for pachytene
#'
......@@ -65,10 +65,10 @@ get_pachytene <- function(img_path, species_num = 20, offset = 0.2,ecc_thresh =
filename_path_test <- paste0(img_path,"/crops/", img_file)
img_file <- filename_path_test
if(grepl(paste0('*',channel2_string,'.',file_ext,'$'), img_file)){
file_dna <- img_file
file_base_dna <- file_base
file_sc <- img_file
file_base_sc <- file_base
image_count <- image_count +1
image <- readImage(file_dna)
image <- readImage(file_sc)
img_orig_highres <- channel(image, "grey")
img_orig <- channel(strand_amp*image, "grey")
img_orig <- resize(img_orig, w = resize_l, h = resize_l)
......@@ -130,8 +130,8 @@ get_pachytene <- function(img_path, species_num = 20, offset = 0.2,ecc_thresh =
stage_classification <- "pachytene"
df_cells <- rbind(df_cells,t(c(img_file,cell_count,genotype,px_mask, px_total,px_fraction, mean_ecc,mean_ratio,skew,sd_bright_px,stage_classification)))
pachytene_count <- pachytene_count + 1
file_dna <- tools::file_path_sans_ext(file_base_dna)
filename_crop <- paste0(img_path_out,"/pachytene/", file_dna,'.',file_ext)
file_sc <- tools::file_path_sans_ext(file_base_sc)
filename_crop <- paste0(img_path_out,"/pachytene/", file_sc,'.',file_ext)
writeImage(img_orig_highres, filename_crop)
if(annotation == "on"){
print("decided the following is pachytene")
......@@ -144,7 +144,7 @@ get_pachytene <- function(img_path, species_num = 20, offset = 0.2,ecc_thresh =
ch1 <-channel(img_orig_highres,"grey")
ch2 <- channel(img_orig_foci,"grey")
RGB_img <- rgbImage(ch1,ch2,0*ch1)
filename_crop_RGB <- paste0(img_path_out,"/pachytene-RGB/", file_dna,'.',file_ext)
filename_crop_RGB <- paste0(img_path_out,"/pachytene-RGB/", file_sc,'.',file_ext)
writeImage(RGB_img, filename_crop_RGB)
}
}
......
......@@ -59,9 +59,9 @@ Used in thresholding to make blob mask.}
\item{test_amount, }{Optional number of first N images you want to run
function on. For troubleshooting/testing/variable calibration purposes.}
\item{brush_size_blob, }{Brush size for smudging the dna channel to make blobs}
\item{brush_size_blob, }{Brush size for smudging the synaptonemal complex channel to make blobs}
\item{sigma_blob, }{Sigma in Gaussian brush for smudging the dna channel
\item{sigma_blob, }{Sigma in Gaussian brush for smudging the synaptonemal complex channel
to make blobs}
\item{channel3_string}{Optional. String appended to the files showing the
......@@ -100,7 +100,7 @@ characteristic blob radius. Defaults to 1. May need to increase if using
watershed.}
}
\value{
cropped SC and foci channels around single cells, regardless of stage
cropped synaptonemal complex and foci channels around single cells, regardless of stage
}
\description{
crop an image around each viable cell candidate.
......
......@@ -29,7 +29,7 @@ count_foci(
min_foci = -1,
disc_size = 51,
modify_problematic = "off",
disc_size_foci = 7,
disc_size_foci = 5,
C1 = 0.02,
C2 = 0.46,
C_weigh_foci_number = TRUE
......@@ -39,10 +39,10 @@ count_foci(
\item{img_path, }{path containing crops to analyse}
\item{stage, }{meiosis stage of interest. Currently count_foci determines
this with thresholding/ object properties in the dna channel. But will be
this with thresholding/ object properties in the synaptonemal complex channel. But will be
classified using ML model in future versions.}
\item{offset_px, }{Pixel value offset used in thresholding of dna channel}
\item{offset_px, }{Pixel value offset used in thresholding of synaptonemal complex channel}
\item{offset_factor, }{Pixel value offset used in thresholding of foci channel}
......@@ -92,7 +92,7 @@ have foci > 100 or so.}
\item{min_foci}{minimum pixel area for a foci. Depends on your dpi etc. Defaults to 4}
\item{disc_size}{size of disc for local background calculation in dna channel}
\item{disc_size}{size of disc for local background calculation in synaptonemal complex channel}
\item{modify_problematic}{option for synapsis to try and "save" images which
have likely been counted incorrectly due to a number of reasons. Default
......@@ -111,7 +111,7 @@ C1 (weighing with number). Otherwise set to FALSE to use C2}
data frame with foci count per cell
}
\description{
Calculates coincident foci in SC and foci channel, per cell
Calculates coincident foci in synaptonemal complex and foci channel, per cell
}
\details{
In this function, masks for the synaptonemal complex (SC) and foci channel
......
......@@ -11,7 +11,7 @@ crop_single_object_fast(
img_orig,
img_orig_foci,
img_orig_DAPI = "blank",
file_dna,
file_sc,
file_foci,
file_DAPI = "blank",
cell_count,
......@@ -50,7 +50,7 @@ all other cells where counter_single not equal to counter_final.}
\item{img_orig_DAPI, }{description}
\item{file_dna, }{filename of dna channel image}
\item{file_sc, }{filename of synaptonemal complex channel image}
\item{file_foci, }{filename of foci channel image}
......
......@@ -33,9 +33,9 @@ to make blob mask.}
\item{final_blob_amp, }{Contrast factor to multiply smoothed/smudged image.
Used in thresholding to make blob mask.}
\item{brush_size_blob, }{Brush size for smudging the dna channel to make blobs}
\item{brush_size_blob, }{Brush size for smudging the synaptonemal complex channel to make blobs}
\item{sigma_blob, }{Sigma in Gaussian brush for smudging the dna channel to
\item{sigma_blob, }{Sigma in Gaussian brush for smudging the synaptonemal complex channel to
make blobs}
\item{watershed_tol}{Intensity tolerance for watershed method. Defaults to 0.05.}
......
......@@ -36,7 +36,7 @@ get_coincident_foci(
)
}
\arguments{
\item{offset_px, }{Pixel value offset used in thresholding of dna channel}
\item{offset_px, }{Pixel value offset used in thresholding of synaptonemal complex channel}
\item{offset_factor, }{Pixel value offset used in thresholding of foci channel}
......@@ -62,12 +62,20 @@ have foci > 100 or so.}
\item{strand_amp}{multiplication of strand channel to make masks}
\item{disc_size}{size of disc for local background calculation in dna channel}
\item{disc_size}{size of disc for local background calculation in synaptonemal complex channel}
\item{disc_size_foci}{size of disc for local background calculation in foci channel}
\item{img_file}{cell's file name}
\item{cell_count}{unique cell counter}
\item{img_orig}{original strand crop}
\item{img_orig_foci}{cropped foci channel}
\item{stage, }{meiosis stage of interest. Currently count_foci determines
this with thresholding/ object properties in the dna channel. But will be
this with thresholding/ object properties in the synaptonemal complex channel. But will be
classified using ML model in future versions.}
\item{WT_str}{string in filename corresponding to wildtype genotype.
......@@ -82,10 +90,17 @@ Defaults to +/+.}
\item{KO_out}{string in output csv in genotype column, for knockout.
Defaults to -/-.}
\item{C1_search}{TRUE or FALSE whether the image is still being modified
until it meets the crispness criteria}
\item{discrepant_category}{estimated number of foci that are NOT on a strand.}
\item{C1}{Default crispness criteria = sd(foci_area)/(mean(foci_area)+1)}
\item{C2}{Alternative crisp criteria.}
\item{df_cells}{current data frame}
\item{C_weigh_foci_number}{choose crispness criteria- defaults to TRUE to use
C1 (weighing with number). Otherwise set to FALSE to use C2}
}
......
......@@ -22,7 +22,7 @@ get_foci_per_cell(
\arguments{
\item{img_file}{cell's file name}
\item{offset_px, }{Pixel value offset used in thresholding of dna channel}
\item{offset_px, }{Pixel value offset used in thresholding of synaptonemal complex channel}
\item{stage}{meitoic stage, currently pachytene or not.}
......
......@@ -29,7 +29,7 @@ get_pachytene(
\item{species_num, }{number of chromosomes in the species}
\item{offset, }{Pixel value offset used in therholding for the dna (SYCP3) channel}
\item{offset, }{Pixel value offset used in therholding for the synaptonemal complex (SYCP3) channel}
\item{ecc_thresh, }{The minimum average eccentricity of all objects in mask determined by computefeatures, for a cell to be pachytene.}
......@@ -60,7 +60,7 @@ get_pachytene(
\item{resize_l}{length of resized square cell image.}
}
\value{
Pairs of foci and SC channel crops for pachytene
Pairs of foci and synaptonemal channel crops for pachytene
}
\description{
Identifies crops in pachytene
......
......@@ -14,13 +14,13 @@ make_strand_mask(
)
}
\arguments{
\item{offset_px, }{Pixel value offset used in thresholding of dna channel}
\item{offset_px, }{Pixel value offset used in thresholding of synaptonemal complex channel}
\item{stage}{meitoic stage, currently pachytene or not.}
\item{img_orig}{original strand crop}
\item{disc_size}{size of disc for local background calculation in dna channel}
\item{disc_size}{size of disc for local background calculation in synaptonemal complex channel}
\item{brush_size, }{size of brush to smooth the foci channel. Should be small
to avoid erasing foci.}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment