/// <summary>
        /// Makes all values absolute
        /// </summary>
        /// <param name="queue">cloo command queue</param>
        /// <param name="source">image source</param>
        /// <param name="dest">image destination</param>
        public void Abs(IImage2DFloat source, IImage2DFloat dest)
        {
            if (source == null) throw new ArgumentNullException("source");
            if (dest == null) throw new ArgumentNullException("dest");
            if ((source.Width > dest.Width) || (source.Height > dest.Height)) throw new ArgumentException("Destination image (" + dest.Width + "x" + dest.Height + ") must have at least the same size as the source image (" + source.Width + "x" + source.Height + ")");

            int length = source.HostBuffer.Length;
            for (int i = 0; i < length; i++)
                dest.HostBuffer[i] = Math.Abs(source.HostBuffer[i]);
            dest.Normalized = source.Normalized;
        }
        /// <summary>
        /// Clamps minimum and maximum value
        /// </summary>
        /// <param name="source">image source</param>
        /// <param name="dest">image destination</param>
        /// <param name="sampler">sampler to be used for image reading</param>
        /// <param name="minValue">minimum value</param>
        /// <param name="maxValue">maximum value</param>
        public void Clamp(IImage2DFloat source, IImage2DFloat dest, float minValue, float maxValue)
        {
            if (source == null) throw new ArgumentNullException("source");
            if (dest == null) throw new ArgumentNullException("dest");
            if ((source.Width > dest.Width) || (source.Height > dest.Height)) throw new ArgumentException("Destination image (" + dest.Width + "x" + dest.Height + ") must have at least the same size as the source image (" + source.Width + "x" + source.Height + ")");

            int length = source.HostBuffer.Length;
            for (int i = 0; i < length; i++)
            {
                float val = source.HostBuffer[i];
                if (val < minValue) val = minValue;
                else
                    if (val > maxValue) val = maxValue;
                dest.HostBuffer[i] = val;
            }
            dest.Normalized = source.Normalized;
        }
        /// <summary>
        /// Convert float image to byte image
        /// </summary>
        /// <param name="source">image source</param>
        /// <param name="dest">image destination</param>
        public void FloatToByte(IImage2DFloat source, IImage2DByte dest)
        {
            if (source == null) throw new ArgumentNullException("source");
            if (dest == null) throw new ArgumentNullException("dest");
            if ((source.Width > dest.Width) || (source.Height > dest.Height)) throw new ArgumentException("Destination image (" + dest.Width + "x" + dest.Height + ") must have at least the same size as the source image (" + source.Width + "x" + source.Height + ")");

            if (source.Normalized)
            {
                // use normalized kernel
                int length = source.HostBuffer.Length;
                for (int i = 0; i < length; i++)
                {
                    float val = 255f * source.HostBuffer[i];
                    if (val < 0) val = 0;
                    else
                        if (val > 255) val = 255;
                    dest.HostBuffer[i] = (byte)val;
                }
            }
            else
            {
                // use normal kernel
                int length = source.HostBuffer.Length;
                for (int i = 0; i < length; i++)
                {
                    float val = source.HostBuffer[i];
                    if (val < 0) val = 0;
                    else
                        if (val > 255) val = 255;
                    dest.HostBuffer[i] = (byte)val;
                }
            }
        }
        /// <summary>
        /// Sets a constant value to all cells in an image
        /// </summary>
        /// <param name="image">image</param>
        /// <param name="value">value to set</param>
        public void SetValue(IImage2DFloat image, float value)
        {
            if (image == null) throw new ArgumentNullException("image");

            image.HostBuffer.Clear(value);
        }