\HeaderA{display}{Interactive image display}{display}
\aliasA{animate}{display}{animate}
\aliasA{animate,array-method}{display}{animate,array.Rdash.method}
\aliasA{animate,Image-method}{display}{animate,Image.Rdash.method}
\aliasA{animate,IndexedImage-method}{display}{animate,IndexedImage.Rdash.method}
\keyword{file}{display}
\begin{Description}\relax
Display images on the screen of a local or remote display.
\end{Description}
\begin{Usage}
\begin{verbatim}
  display(x, no.GTK=FALSE, ...)

  ## S4 method for signature 'Image':
  animate(x, ...)        ## not available on Windows
  ## S4 method for signature 'IndexedImage':
  animate(x, ...) ## not available on Windows
  ## S4 method for signature 'array':
  animate(x, ...)        ## not available on Windows
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{x}] An object of \code{\LinkA{Image}{Image.Rdash.class}}, \code{\LinkA{IndexedImage}{IndexedImage.Rdash.class}}
or \code{\LinkA{array}{array}}. 
\item[\code{no.GTK}] A logical value, if \code{TRUE} an \emph{ImageMagick}
display will be used instead of the GTK display (read details below). 
On Windows the \emph{ImageMagick} display is not available. 
\item[\code{...}] Reserved. 
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
The argument \code{main} can be used with the GTK display to substitute the
default window title. By default, the GTK display shows the expression used
in call to \code{display} for the window title.

When used with \code{\LinkA{IndexedImage}{IndexedImage.Rdash.class}} \code{display} additionally 
accepts a \code{colorize} argument. If it is provided with any value of any 
class, then objects are mapped on the display using random RGB colors.

If available the \code{GTK} display will be used by default. This mode allows
display of multiple images simultaneously. If the \code{GTK} mode is not used,
an \code{ImageMagick}-internal display function, is used. This mode is
for compatibility purposes only and should not be used if \code{GTK} is
available. Because \code{ImageMagick} does not provide any programmatic ways to
control and close display windows, the display in this mode is limited to one
it time. The display window must be explicitly closed before a new image can
be displayed. If \code{EBImage} was installed without \code{GTK} support,
the function will fall back to the \code{ImageMagick} display automatically.
In this case there is no need to supply \code{no.GTK} argument.

So far \code{animate} uses the \code{AnimateImages} function from
\code{ImageMagick}, which behavior is analogous to that of the \code{ImageMagick} 
display. This function is not available on Windows due to the lack of support
in the \code{ImageMagick} API.

\code{GTK} display does not use \code{GTK} widgets available from other \code{R}
packages, the functionality is coded in \code{EBImage}. Therefore, the package
must be compiled with \code{GTK} support in order to enable it.
\end{Details}
\begin{Value}
An invisible \code{NULL}.
\end{Value}
\begin{Author}\relax
Oleg Sklyar, \email{osklyar@ebi.ac.uk}, 2005-2007
\end{Author}
\begin{References}\relax
\emph{ImageMagick}: \url{http://www.imagemagick.org}; \emph{GTK}: 
\url{http://www.gtk.org}; \emph{GTK on Windows}: \url{http://gladewin32.sf.net}
\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}, \LinkA{Image}{Image.Rdash.class}
}
\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}

  ## load images of nuclei (seed points later)
  f <- paste( system.file(package="EBImage"), "images/Gene1_G.tif", sep="/" )
  ii = readImage(f)
  ## normalize images
  ii = normalize(ii, separate=TRUE)
  ## segment
  mask = thresh(ii, 25, 25, 0.02)
  ## refine segmentation with morphology filters
  mk3 = morphKern(3)
  mk5 = morphKern(5)
  mask = dilate(erode(closing(mask, mk5), mk3), mk5)
  ## index objects with 'watershed'
  io = watershed( distmap(mask), 1.5, 1)
  if (interactive()) {
    display(io)
    display(io, main="Watershed segmentation", colorize=T)
  }
\end{ExampleCode}
\end{Examples}

