# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
# --------------------------------------------------------------------------------------------
# - Generated by tools/entrypoint_compiler.py: do not edit by hand
"""
PixelExtractor
"""

__all__ = ["PixelExtractor"]


from sklearn.base import TransformerMixin

from ...base_transform import BaseTransform
from ...internal.core.feature_extraction.image.pixelextractor import \
    PixelExtractor as core
from ...internal.utils.utils import trace


class PixelExtractor(core, BaseTransform, TransformerMixin):
    """

    Extracts the pixel values from an image.

    .. remarks::
        ``PixelExtractor`` extracts the pixel values from an image. The input
        variables
        are images of the same size, typically the output of a ``Resizer``
        transform. The
        output are pixel data in vector form that are typically used as
        features for a learner.

    :param columns: a dictionary of key-value pairs, where key is the output
        column name and value is the input column name.

        * Multiple key-value pairs are allowed.
        * Input column type: :ref:`Picture`.
        * Output column type:
         `Vector Type </nimbusml/concepts/types#vectortype-column>`_.
        * If the output column names are same as the input column names, then
        simply specify ``columns`` as a list of strings.

        The << operator can be used to set this value (see
        `Column Operator </nimbusml/concepts/columns>`_)

        For example
         * PixelExtractor(columns={'out1':'input1', 'out2':'input2'})
         * PixelExtractor() << {'out1':'input1', 'out2':'input2'}

        For more details see `Columns </nimbusml/concepts/columns>`_.

    :param use_alpha: Specifies whether to use alpha channel. The default
        value is ``False``.

    :param use_red: Specifies whether to use red channel. The default value
        is ``True``.

    :param use_green: Specifies whether to use green channel. The default
        value is ``True``.

    :param use_blue: Specifies whether to use blue channel. The default value
        is ``True``.

    :param interleave_argb: Whether to separate each channel or
        interleave in ARGB order. This might be important, for example, if
        you are training
        a convolutional neural network, since this would affect the shape of
        the kernel, stride etc.

    :param convert: Whether to convert to floating point. The default value
        is ``False``.

    :param offset: Specifies the offset (pre-scale). This requires ``convert
        = True``.
        The default value is `None`.

    :param scale: Specifies the scale factor. This requires ``convert =
        True``.
        The default value is `None`.

    :param params: Additional arguments sent to compute engine.

    .. seealso::
        :py:class:`Loader <nimbusml.feature_extraction.image.Loader>`,
        :py:class:`Resizer <nimbusml.feature_extraction.image.Resizer>`.

    .. index:: transform, image

    Example:
       .. literalinclude:: /../nimbusml/examples/Image.py
              :language: python
    """

    @trace
    def __init__(
            self,
            use_alpha=False,
            use_red=True,
            use_green=True,
            use_blue=True,
            interleave_argb=False,
            convert=True,
            offset=None,
            scale=None,
            columns=None,
            **params):

        if columns:
            params['columns'] = columns
        BaseTransform.__init__(self, **params)
        core.__init__(
            self,
            use_alpha=use_alpha,
            use_red=use_red,
            use_green=use_green,
            use_blue=use_blue,
            interleave_argb=interleave_argb,
            convert=convert,
            offset=offset,
            scale=scale,
            **params)
        self._columns = columns

    def get_params(self, deep=False):
        """
        Get the parameters for this operator.
        """
        return core.get_params(self)
