\HeaderA{IndexedImage-class}{Defintion of class 'IndexedImage'}{IndexedImage.Rdash.class}
\aliasA{as.Image,IndexedImage-method}{IndexedImage-class}{as.Image,IndexedImage.Rdash.method}
\keyword{methods}{IndexedImage-class}
\keyword{classes}{IndexedImage-class}
\begin{Description}\relax
The class \code{IndexedImage} is used to store the results of functions that
index image into separate objects using integer 1-based indexing. Such an
image is essentially the same as \code{\LinkA{Image}{Image.Rdash.class}} in the gray scale
mode. The class was defined to ensure correct types in calls to other object
detection and processing routines.
\end{Description}
\begin{Section}{Class Definition}
\begin{alltt}
    \#\# S4 class definition
    setClass( "IndexedImage", contains="Image" )
\end{alltt}
\end{Section}
\begin{Section}{Creating objects}
Objects of this class are not supposed to be created directly, rather as the 
result of calls to \code{\LinkA{watershed}{watershed}} or \code{\LinkA{propagate}{propagate}}, or other
functions that index objects in images.
\end{Section}
\begin{Section}{Details}
No accessor methods are defined for this class, however all of the 
parents' ones are available, i.e. those of \code{\LinkA{Image}{Image.Rdash.class}} 
and \code{\LinkA{array}{array}}.

One coersion routine is defined in addition, which simply sets the class 
attribute to \code{Image}:

\begin{alltt}
    \#\# S4 method for signature 'x=IndexedImage'
    as.Image(x, ...)
\end{alltt}

When used with \code{IndexedImage}'s \code{display} by default normalizes the 
image.
\end{Section}
\begin{Author}\relax
Oleg Sklyar, \email{osklyar@ebi.ac.uk}, 2007
\end{Author}
\begin{SeeAlso}\relax
\code{
  \LinkA{Image}{Image.Rdash.class}, \LinkA{Image}{Image.Rdash.class}, \LinkA{Image}{Image.Rdash.class}
}
\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
  ## load images
  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)

  class(io)
\end{ExampleCode}
\end{Examples}

