\HeaderA{distmap}{Distance map transform of binary images}{distmap}
\aliasA{distmap,Image-method}{distmap}{distmap,Image.Rdash.method}
\begin{Description}\relax
The function computes a distance map transformation of a binary image,
i.e. of an image whose pixels are labeled as \emph{foreground} and
\emph{background}. 
In the distance map, each pixel contains the distance from that pixel to the nearest
background pixel, or to the border of the image.
Note: this is a trivial brute force implementation. Please look
elsewhere for efficient implementations; see also the references.
\end{Description}
\begin{Usage}
\begin{verbatim}
  ## S4 method for signature 'Image':
  distmap(x, t=0.05, exact=FALSE, bg=0.05, ...)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{x}] A \code{\LinkA{Grayscale}{Grayscale}} object of \code{\LinkA{Image}{Image.Rdash.class}}.
\code{x} is considered as a binary image, consisting of 0's for background
and all other values for foreground. 
\item[\code{t}] A numeric vector of length 1, the background threshold in the range 
\code{[0,1)}. Pixels with intensity smaller than \code{t} are considered 
as background. 
\item[\code{bg}] A numeric numeric vector of length 1, the allowed minimum of the fraction of 
background pixels in the image. Deprecated.
\item[\code{exact}] ???
\item[\code{...}] Further arguments.
\end{ldescription}
\end{Arguments}
\begin{Value}
A \code{\LinkA{Grayscale}{Grayscale}} object of \code{\LinkA{Image}{Image.Rdash.class}} with pixels
containing the \code{\LinkA{floor}{floor}} values of their distances to the nearest 
background points.
\end{Value}
\begin{Author}\relax
Oleg Sklyar, \email{osklyar@ebi.ac.uk}, 2006
\end{Author}
\begin{References}\relax
2D Euclidean Distance Transform Algorithms: A Comparative Survey.
R. Fabbri, L. da F. Costa, J.C. Torelli and O.M. Bruno. ACM Computing
Surveys, Vol. 40, No. 1, Article 2 (Feb. 2008).

The Image Processing Handbook. John Russ. 5th edition, 2006, CRC Press.

VIGRA by Ullrich Koethe: http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra
\end{References}
\begin{SeeAlso}\relax
\code{
    \LinkA{Image}{Image.Rdash.class}, \LinkA{Image}{Image.Rdash.class}, \LinkA{Image}{Image.Rdash.class}, \LinkA{Image}{Image.Rdash.class}
  }
\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
  ## Not run: see ?watershed for an example
\end{ExampleCode}
\end{Examples}

