Commit 738db848 authored by Lucy McNeill's avatar Lucy McNeill
Browse files

count foci defaults to watershed method for non-pachytene cells

parent 1c3c287c
No preview for this file type
......@@ -18,10 +18,13 @@
#' @param WT_str string in filename corresponding to wildtype genotype. Defaults to ++.
#' @param KO_out string in output csv in genotype column, for knockout. Defaults to -/-.
#' @param WT_out string in output csv in genotype column, for knockout. Defaults to +/+.
#' @param watershed_stop Turn off default watershed method with "off"
#' @param watershed_radius Radius (ext variable) in watershed method used in foci channel. Defaults to 1 (small)
#' @param watershed_tol Intensity tolerance for watershed method. Defaults to 0.05.
#' @return 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 = "+/+")
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)
{
cell_count <- 0
image_count <-0
......@@ -98,6 +101,7 @@ count_foci <- function(img_path, stage = "none", offset_px = 0.2, offset_factor
offset = offset_factor*bg
if(stage != "pachytene"){
foci_th = foci_mask_crop > bg + offset
#foci_th <- watershed(bwlabel(foci_th)*as.matrix(img_orig_foci),tolerance=0.05, ext=1)
}
else{
### smooth it
......@@ -116,7 +120,14 @@ count_foci <- function(img_path, stage = "none", offset_px = 0.2, offset_factor
num_strands <- data.frame(num_strands)
##### print properties of the images
coincident_foci <- bwlabel(foci_label*strands)
if(watershed_stop != "off"){
coincident_foci <- bwlabel(foci_label*strands)
}
else{
coincident_foci <- watershed(bwlabel(foci_th*strands)*as.matrix(img_orig_foci),tolerance=watershed_tol, ext=watershed_radius)
}
### multiply strands by foci_label
if(annotation == "on"){
print("at file")
......@@ -129,6 +140,9 @@ count_foci <- function(img_path, stage = "none", offset_px = 0.2, offset_factor
print("displaying resulting foci count")
print("Overlay two channels")
display(rgbImage(strands,foci_label,0*foci_label))
#print("showing the watershed masks")
#display(foci_th)
#display(colorLabels(watershed(bwlabel(foci_th)*as.matrix(img_orig_foci),tolerance=0.05, ext=1)))
print("coincident foci")
display(colorLabels(coincident_foci))
print("two channels, only coincident foci")
......
......@@ -16,7 +16,8 @@ auto_crop(
final_blob_amp = 10,
test_amount = 0,
brush_size_blob = 51,
sigma_blob = 15
sigma_blob = 15,
cell_aspect_ratio = 2
)
}
\arguments{
......@@ -43,6 +44,8 @@ auto_crop(
\item{brush_size_blob, }{Brush size for smudging the dna channel to make blobs}
\item{sigma_blob, }{Sigma in Gaussian brush for smudging the dna channel to make blobs}
\item{cell_aspect_ratio}{Maximum aspect ratio of blob to be defined as a cell}
}
\value{
cropped SC and foci channels around single cells, regardless of stage
......
......@@ -21,7 +21,8 @@ auto_crop_fast(
channel2_string = "SYCP3",
channel1_string = "MLH3",
file_ext = "jpeg",
third_channel = "off"
third_channel = "off",
cell_aspect_ratio = 2
)
}
\arguments{
......@@ -49,15 +50,7 @@ auto_crop_fast(
\item{sigma_blob, }{Sigma in Gaussian brush for smudging the dna channel to make blobs}
\item{channel3_string}{Defaults to DAPI (if third channel is on)}
\item{channel2_string}{String appended to the files showing the channel illuminating synaptonemal complexes. Defaults to SYCP3}
\item{channel1_string}{String appended to the files showing the channel illuminating foci. Defaults to MLH3}
\item{file_ext}{file extension of your images e.g. tiff jpeg or png.}
\item{third_channel}{Whether there is a third channel e.g. DAPI stain. On or off. Defaults to off.}
\item{cell_aspect_ratio}{Maximum aspect ratio of blob to be defined as a cell}
}
\value{
cropped SC and foci channels around single cells, regardless of stage
......
......@@ -15,7 +15,14 @@ count_foci(
annotation = "off",
channel2_string = "SYCP3",
channel1_string = "MLH3",
file_ext = "jpeg"
file_ext = "jpeg",
KO_str = "--",
WT_str = "++",
KO_out = "-/-",
WT_out = "+/+",
watershed_stop = "off",
watershed_radius = 1,
watershed_tol = 0.05
)
}
\arguments{
......@@ -40,6 +47,20 @@ count_foci(
\item{channel1_string}{String appended to the files showing the channel illuminating foci. Defaults to MLH3}
\item{file_ext}{file extension of your images e.g. tiff jpeg or png.}
\item{KO_str}{string in filename corresponding to knockout genotype. Defaults to --.}
\item{WT_str}{string in filename corresponding to wildtype genotype. Defaults to ++.}
\item{KO_out}{string in output csv in genotype column, for knockout. Defaults to -/-.}
\item{WT_out}{string in output csv in genotype column, for knockout. Defaults to +/+.}
\item{watershed_stop}{Turn off default watershed method with "off"}
\item{watershed_radius}{Radius (ext variable) in watershed method used in foci channel. Defaults to 1 (small)}
\item{watershed_tol}{Intensity tolerance for watershed method. Defaults to 0.05.}
}
\value{
foci count per cell
......
......@@ -63,16 +63,6 @@ crop_single_object_fast(
\item{cx}{centre of blob x}
\item{cy}{centre of blob y}
\item{channel3_string}{Defaults to DAPI (if third channel is on)}
\item{channel2_string}{String appended to the files showing the channel illuminating synaptonemal complexes. Defaults to SYCP3}
\item{channel1_string}{String appended to the files showing the channel illuminating foci. Defaults to MLH3}
\item{file_ext}{file extension of your images e.g. tiff jpeg or png.}
\item{third_channel}{Whether there is a third channel e.g. DAPI stain. On or off. Defaults to off.}
}
\value{
Crops around all candidates in both channels
......
......@@ -16,7 +16,11 @@ get_distance(
annotation,
eccentricity_min,
max_strand_area,
cell_count
cell_count,
KO_str,
WT_str,
KO_out,
WT_out
)
}
\arguments{
......@@ -41,6 +45,14 @@ get_distance(
\item{max_strand_area, }{Maximum pixel area of a strand}
\item{cell_count}{Unique cell counter}
\item{KO_str}{string in filename corresponding to knockout genotype. Defaults to --.}
\item{WT_str}{string in filename corresponding to wildtype genotype. Defaults to ++.}
\item{KO_out}{string in output csv in genotype column, for knockout. Defaults to -/-.}
\item{WT_out}{string in output csv in genotype column, for knockout. Defaults to +/+.}
}
\value{
Data frame with properties of synaptonemal (SC) measurements
......
......@@ -24,7 +24,11 @@ get_distance_between_two(
file,
annotation,
cell_count,
uid_strand
uid_strand,
KO_str,
WT_str,
KO_out,
WT_out
)
}
\arguments{
......@@ -67,6 +71,14 @@ get_distance_between_two(
\item{cell_count}{Unique cell number}
\item{uid_strand}{Unique strand number}
\item{KO_str}{string in filename corresponding to knockout genotype. Defaults to --.}
\item{WT_str}{string in filename corresponding to wildtype genotype. Defaults to ++.}
\item{KO_out}{string in output csv in genotype column, for knockout. Defaults to -/-.}
\item{WT_out}{string in output csv in genotype column, for knockout. Defaults to +/+.}
}
\value{
List of fractional distances between foci for all SCs with two. Optional: total distances of SCs. Optional: images of all resulting traces/ foci locations.
......
......@@ -13,7 +13,11 @@ get_pachytene(
annotation = "off",
channel2_string = "SYCP3",
channel1_string = "MLH3",
file_ext = "jpeg"
file_ext = "jpeg",
KO_str = "--",
WT_str = "++",
KO_out = "-/-",
WT_out = "+/+"
)
}
\arguments{
......@@ -34,6 +38,14 @@ get_pachytene(
\item{channel1_string}{String appended to the files showing the channel illuminating foci. Defaults to MLH3}
\item{file_ext}{file extension of your images e.g. tiff jpeg or png.}
\item{KO_str}{string in filename corresponding to knockout genotype. Defaults to --.}
\item{WT_str}{string in filename corresponding to wildtype genotype. Defaults to ++.}
\item{KO_out}{string in output csv in genotype column, for knockout. Defaults to -/-.}
\item{WT_out}{string in output csv in genotype column, for knockout. Defaults to +/+.}
}
\value{
Pairs of foci and SC channel crops for pachytene
......
......@@ -4,7 +4,7 @@
\alias{keep_cells}
\title{keep_cells}
\usage{
keep_cells(candidate, max_cell_area, min_cell_area)
keep_cells(candidate, max_cell_area, min_cell_area, cell_aspect_ratio)
}
\arguments{
\item{candidate}{Mask of individual cell candidates}
......@@ -12,6 +12,8 @@ keep_cells(candidate, max_cell_area, min_cell_area)
\item{max_cell_area, }{Maximum pixel area of a cell candidate}
\item{min_cell_area, }{Minimum pixel area of a cell candidate}
\item{cell_aspect_ratio}{Maximum aspect ratio of blob to be defined as a cell}
}
\value{
Mask of cell candidates which meet size criteria
......
......@@ -17,7 +17,11 @@ measure_distances(
max_strand_area = 300,
channel2_string = "SYCP3",
channel1_string = "MLH3",
file_ext = "jpeg"
file_ext = "jpeg",
KO_str = "--",
WT_str = "++",
KO_out = "-/-",
WT_out = "+/+"
)
}
\arguments{
......@@ -46,6 +50,14 @@ measure_distances(
\item{channel1_string}{String appended to the files showing the channel illuminating foci. Defaults to MLH3}
\item{file_ext}{file extension of your images e.g. tiff jpeg or png.}
\item{KO_str}{string in filename corresponding to knockout genotype. Defaults to --.}
\item{WT_str}{string in filename corresponding to wildtype genotype. Defaults to ++.}
\item{KO_out}{string in output csv in genotype column, for knockout. Defaults to -/-.}
\item{WT_out}{string in output csv in genotype column, for knockout. Defaults to +/+.}
}
\value{
Data frame with properties of synaptonemal (SC) measurements
......
No preview for this file type
Supports Markdown
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