% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/functions.R
\name{threshold_image}
\alias{threshold_image}
\title{Setting a threshold to create a binary image matrix}
\usage{
threshold_image(mat, percentage, count = TRUE)
}
\arguments{
\item{mat}{Image matrix}

\item{percentage}{Percentage cutoff for foreground and background pixels (estimated using \code{criterion_1()})}

\item{count}{Boolean to calculate sum of foreground pixels after thresholding; default is TRUE}
}
\value{
Returns either the sum of foreground pixels (when count is TRUE) or the binary matrix after thresholding (when count is FALSE)
}
\description{
Sets a threshold based on quantile of pixel value to create a binary image matrix,
where foreground pixels correspond with cell objects.
}
