\HeaderA{channel}{Color and image color mode conversions}{channel}
\aliasA{rgbImage}{channel}{rgbImage}
\begin{Description}\relax
\code{channel} handles color space conversions between image modes.
\code{rgbImage} combines \code{Grayscale} images into a \code{Color} one.
\end{Description}
\begin{Usage}
\begin{verbatim} 
  channel(x, mode)
  rgbImage(red, green, blue)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{x}] An \code{Image} object or an array.
\item[\code{mode}] A character value specifying the target mode for
conversion. See Details.
\item[\code{red, green, blue}] \code{Image} objects in \code{Grayscale}
color mode or arrays of the same dimension. If missing, a
black image will be used.
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
Conversion modes:
\describe{
\item[\code{rgb}] Converts a \code{Grayscale} image or an array
into a \code{Color} image, replicating RGB channels.

\item[\code{gray, grey}] Converts a \code{Color} image into a
\code{Grayscale} image, using uniform 1/3 RGB weights.

\item[\code{red, green, blue}] Extracts the \code{red}, \code{green} or
\code{blue} channel from a \code{Color} image. Returns a
\code{Grayscale} image.

\item[\code{asred, asgreen, asblue}] Converts a \code{Grayscale}
image or an array into a \code{Color} image of the specified hue.
}

\code{channel} changes the pixel intensities, unlike \code{colorMode}
which just changes the way that EBImage should render an image,
\end{Details}
\begin{Value}
An \code{Image} object or an array.
\end{Value}
\begin{Author}\relax
Oleg Sklyar, \email{osklyar@ebi.ac.uk}
\end{Author}
\begin{SeeAlso}\relax
\code{\LinkA{colorMode}{colorMode}}
\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
 x = readImage(system.file("images", "shapes.png", package="EBImage"))
 if (interactive()) display(x)
 y = channel(x, 'asgreen')
 if (interactive()) display(y)

 ## rgbImage
 x = readImage(system.file('images', 'nuclei.tif', package='EBImage'))
 y = readImage(system.file('images', 'cells.tif', package='EBImage'))
 if (interactive()) display(x, title='Cell nuclei')
 if (interactive()) display(y, title='Cell bodies')

 cells = rgbImage(green=1.5*y, blue=x)
 if (interactive()) display(cells, title='Cells')
\end{ExampleCode}
\end{Examples}

