\HeaderA{Image}{Image class}{Image}
\aliasA{as.Image}{Image}{as.Image}
\aliasA{Color}{Image}{Color}
\aliasA{colorMode}{Image}{colorMode}
\aliasA{colormode}{Image}{colormode}
\aliasA{colorMode<\Rdash}{Image}{colorMode<.Rdash.}
\aliasA{getNumberOfFrames}{Image}{getNumberOfFrames}
\aliasA{Grayscale}{Image}{Grayscale}
\aliasA{hist,Image-method}{Image}{hist,Image.Rdash.method}
\aliasA{image,Image-method}{Image}{image,Image.Rdash.method}
\aliasA{Image-class}{Image}{Image.Rdash.class}
\aliasA{imageData}{Image}{imageData}
\aliasA{imageData<\Rdash}{Image}{imageData<.Rdash.}
\aliasA{is.Image}{Image}{is.Image}
\aliasA{median.Image}{Image}{median.Image}
\aliasA{Ops,Image,Image-method}{Image}{Ops,Image,Image.Rdash.method}
\aliasA{Ops,Image,numeric-method}{Image}{Ops,Image,numeric.Rdash.method}
\aliasA{Ops,numeric,Image-method}{Image}{Ops,numeric,Image.Rdash.method}
\aliasA{print.Image}{Image}{print.Image}
\aliasA{quantile.Image}{Image}{quantile.Image}
\aliasA{show,Image-method}{Image}{show,Image.Rdash.method}
\aliasA{TrueColor}{Image}{TrueColor}
\aliasA{[,Image,ANY,ANY,ANY-method}{Image}{[,Image,ANY,ANY,ANY.Rdash.method}
\aliasA{[,Image-method}{Image}{[,Image.Rdash.method}
\begin{Description}\relax
The package \code{EBImage} uses the class \code{Image} to store and process
images. Images are stored as multi-dimensional arrays containing the pixel
intensities. The class \code{Image} extends the base class \code{array} and
uses the \code{colormode} slot to store how the color information of
the multi-dimensional data is handled.

The \code{colormode} slot could be either \code{Grayscale} or \code{Color}. In both modes, the
two first dimensions of the underlying array are understood to be the spatial
dimensions of the image. In the \code{Grayscale} mode, the remaining dimensions
contain other images. In the the \code{Color} mode, the third dimension contains
the red, green and blue channels of the image and the remaining dimensions contain
other images. The color mode \code{TrueColor} exists but is deprecated.

All methods of the package \code{EBImage} works either with \code{Image} objects or
multi-dimensional arrays but in the latter case, the color mode is assumed to be
\code{Grayscale}.
\end{Description}
\begin{Usage}
\begin{verbatim}
  Image(data, dim, colormode)
  as.Image(x)
  is.Image(x)

  colorMode(y)  
  colorMode(y) <- value

  imageData(y)
  imageData(y) <- value 
        
  getNumberOfFrames(y, type='total')    
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{data}] A vector or array containing the pixel intensities of an image. If missing, a default 1x1
null array is used.
\item[\code{dim}] A vector containing the final dimensions of an \code{Image} object. If missing, equals to
\code{dim(data)}.
\item[\code{colormode}] A numeric or a character string containing the color mode which could be
either \code{Grayscale} or \code{Color}. If missing, equals to
\code{Grayscale}.
\item[\code{x}] An R object.
\item[\code{y}] An \code{Image} object or an array.
\item[\code{value}] For \code{colorMode}, a numeric or a character string containing the color mode which
could be either \code{Grayscale} or \code{Color}. For \code{imageData}, an \code{Image} object or an array.
\item[\code{type}] A character string containing \code{total} or \code{render}. If missing, equals to
\code{total}.
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
Depending of \code{type}, \code{getNumberOfFrames} returns the total number of frames contained
in the object \code{y} or the number of renderable frames. The total number of frames is independent
of the color mode and is equal to the product of all the dimensions except the two first ones. The
number of renderable frames is equal to the total number of frames in the \code{Grayscale} color mode
and is equal to the product of all the dimensions except the three first ones in the \code{Color} color mode.
\end{Details}
\begin{Value}
\code{Image} and \code{as.Image} return a new \code{Image} object.

\code{is.Image} returns TRUE if \code{x} is an \code{Image} object and FALSE otherwise.

\code{colorMode} returns the color mode of \code{y} and \code{colorMode<-} changes the color mode 
of \code{y}.

\code{imageData} returns the array contained in an \code{Image} object.
\end{Value}
\begin{Author}\relax
Oleg Sklyar, \email{osklyar@ebi.ac.uk}, 2005-2007
\end{Author}
\begin{SeeAlso}\relax
\code{\LinkA{readImage}{readImage}}, \code{\LinkA{display}{display}}
\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
  s1 = exp(12i*pi*seq(-1, 1, length=300)^2)
  y = Image(outer(Im(s1), Re(s1)))
  if (interactive()) display(normalize(y))

  x = Image(rnorm(300*300*3),dim=c(300,300,3), colormode='Color')
  if (interactive()) display(x) 

  w = matrix(seq(0, 1, len=300), nc=300, nr=300)
  m = abind(w, t(w), along=3)
  z = Image(m, colormode='Color')
  if (interactive()) display(normalize(z))

  y = Image(c('red', 'violet', '#ff51a5', 'yellow'), dim=c(71, 71))
  if (interactive()) display(y)

  ## colorMode example
  x = readImage(system.file('images', 'nuclei.tif', package='EBImage'))
  x = x[,,1:3]
  if (interactive()) display(x, title='Cell nuclei')
  colorMode(x)=Color
  if (interactive()) display(x, title='Cell nuclei in RGB')
\end{ExampleCode}
\end{Examples}

