channel               package:EBImage               R Documentation

_C_o_l_o_r _c_o_n_v_e_r_s_i_o_n

_D_e_s_c_r_i_p_t_i_o_n:

     'channel' allows to convert images and other data in vectors,
     arrays or matrices representing colors from one mode to another.
     The supported modes are: TrueColor (data type: 'integer'),
     Grayscale ('numeric') and X11 strings ('character').

     The mode of the argument is determined automatically from its
     atomic type.

_U_s_a_g_e:


         # S4 method for classes 'Image' and 'ANY':
         channel(x, mode)


_A_a_r_g_u_m_e_n_t_s:

_x A vector, matrix or array of 'integer''s, 'numeric''s or
     'character''s; or an object of 'Image-class'. 

_m_o_d_e A character giving the target mode for conversion. See section
     'Conversion Modes' below. 

_V_a_l_u_e:

     For an argument of 'Image-class' - a new object of 'Image-class'
     in all modes except ''X11''. In case of ''X11'' - a 'character'
     vector of the same length as that of the image.

     For vectors and arrays - be a 'vector' of the same size.

_C_o_n_v_e_r_s_i_o_n _m_o_d_e_s:

     Conversion modes are case insensitive.


     '_r_g_b' The result is a TrueColor representation of the input, its
          class is or includes 'integer', i.e. integer array,
          integer-based image. 

     '_g_r_a_y' The resul is a Grayscale representation of the input, its
          class is or includes 'numeric'. Synonim: 'grey' 

     '_r_e_d, _g_r_e_e_n, _b_l_u_e ' The result image is a Grayscale image
          corresponding to the intensity of the channel requested, its
          class is 'numeric'-based. 

     '_a_s_r_e_d, _a_s_g_r_e_e_n, _a_s_b_l_u_e' The result image is a TrueColor image
          with the input converted to the intensity of the specified
          color channel, its class is 'integer'-based. 

     '_x_1_1' The result is a 'vector' of 'character''s each giving the
          input colors or intensities as X11 strings in the hex
          representation starting with a sharp sign. 

     If input is a 'character' vector, its values may contain color
     names instead of color hex codes, like 'red, purple, white' etc.
     However, the result of the 'X11' mode will always contain hex
     codes.

_A_u_t_h_o_r(_s):

     Oleg Sklyar: osklyar@ebi.ac.uk

_S_e_e _A_l_s_o:

     ' Image-class, Image, read.image, write.image '

_E_x_a_m_p_l_e_s:

       if ( interactive() ) {
         cl <- channel("pink", "rgb")
         r <- channel( channel(cl, "red"), "asred")
         g <- channel( channel("pink", "green"), "asgreen")
         b <- channel( channel(cl, "blue"), "asblue")
         rgb <- r + g + b
         print( rgb == cl )
         clg <- channel(cl, "gray")
         print( channel(cl, "x11"))
       }

