public static InputBand <byte> NewByteBand(GdalBand gdalBand,
                                                   PixelBand pixelBand)
        {
            RasterBandReader <byte> rasterBandReader = RasterBandReaders.NewByteReader(gdalBand);

            switch (pixelBand.TypeCode)
            {
            case TypeCode.Byte:
                return(new InputBand <byte>(rasterBandReader, new PixelBandSetter <byte, byte>(pixelBand, Convert.ToByte)));

            case TypeCode.SByte:
                return(new InputBand <byte>(rasterBandReader, new PixelBandSetter <sbyte, byte>(pixelBand, Convert.ToSByte)));

            case TypeCode.UInt16:
                return(new InputBand <byte>(rasterBandReader, new PixelBandSetter <ushort, byte>(pixelBand, Convert.ToUInt16)));

            case TypeCode.Int16:
                return(new InputBand <byte>(rasterBandReader, new PixelBandSetter <short, byte>(pixelBand, Convert.ToInt16)));

            case TypeCode.UInt32:
                return(new InputBand <byte>(rasterBandReader, new PixelBandSetter <uint, byte>(pixelBand, Convert.ToUInt32)));

            case TypeCode.Int32:
                return(new InputBand <byte>(rasterBandReader, new PixelBandSetter <int, byte>(pixelBand, Convert.ToInt32)));

            case TypeCode.Single:
                return(new InputBand <byte>(rasterBandReader, new PixelBandSetter <float, byte>(pixelBand, Convert.ToSingle)));

            case TypeCode.Double:
                return(new InputBand <byte>(rasterBandReader, new PixelBandSetter <double, byte>(pixelBand, Convert.ToDouble)));

            default:
                throw new ArgumentException("pixelBand.TypeCode is not byte, sbyte, ushort, short, uint, int, float, double");
            }
        }
 public InputBand(RasterBandReader <T> rasterBandReader,
                  IPixelBandSetter <T> pixelBandSetter)
 {
     this.rasterBandReader = rasterBandReader;
     this.pixelBandSetter  = pixelBandSetter;
     blockDimensions       = rasterBandReader.BlockSize;
     bandBuffer            = new BandBuffer <T>(blockDimensions, new Dimensions(rasterBandReader.Rows, rasterBandReader.Columns));
     hasData = false;
 }
        public static InputBand <double> NewDoubleBand(GdalBand gdalBand,
                                                       PixelBand pixelBand)
        {
            RasterBandReader <double> rasterBandReader = RasterBandReaders.NewDoubleReader(gdalBand);

            switch (pixelBand.TypeCode)
            {
            case TypeCode.Double:
                return(new InputBand <double>(rasterBandReader, new PixelBandSetter <double, double>(pixelBand, Convert.ToDouble)));

            default:
                throw new ArgumentException("pixelBand.TypeCode is not double");
            }
        }
        public static InputBand <float> NewFloatBand(GdalBand gdalBand,
                                                     PixelBand pixelBand)
        {
            RasterBandReader <float> rasterBandReader = RasterBandReaders.NewFloatReader(gdalBand);

            switch (pixelBand.TypeCode)
            {
            case TypeCode.Single:
                return(new InputBand <float>(rasterBandReader, new PixelBandSetter <float, float>(pixelBand, Convert.ToSingle)));

            case TypeCode.Double:
                return(new InputBand <float>(rasterBandReader, new PixelBandSetter <double, float>(pixelBand, Convert.ToDouble)));

            default:
                throw new ArgumentException("pixelBand.TypeCode is not float or double");
            }
        }